+ is-open="dOpen" ng-focus="dOpen = true" ng-model="voucher.Date"/>
diff --git a/brewman/static/scripts/angular_directive.js b/brewman/static/scripts/angular_directive.js
index 5a809e27..57baec30 100644
--- a/brewman/static/scripts/angular_directive.js
+++ b/brewman/static/scripts/angular_directive.js
@@ -378,19 +378,18 @@ overlordDirective.directive('fileUpload', function () {
};
});
-overlordDirective.directive('focusOn', ['$timeout', function ($timeout) {
+overlordDirective.directive('focusOn', ['$timeout', '$parse', function ($timeout, $parse) {
return {
restrict: 'A',
- scope: {
- focusOn: '='
- },
link: function (scope, element, attrs) {
- scope.$watch('focusOn', function (value) {
+ scope.$watch(attrs.focusOn, function (value) {
if (value === true) {
- //$timeout(function () {
- element[0].focus();
- scope.focusOn = false;
- //});
+ var getter = $parse(attrs.focusOn);
+ var setter = getter.assign;
+ setter(scope, false);
+ $timeout(function () {
+ element[0].focus();
+ });
}
});
}