diff --git a/brewman/static/partial/journal.html b/brewman/static/partial/journal.html index 0d8ce0f4..d6a488a5 100644 --- a/brewman/static/partial/journal.html +++ b/brewman/static/partial/journal.html @@ -7,7 +7,7 @@
+ is-open="dOpen" ng-focus="dOpen = true" ng-model="voucher.Date"/> @@ -26,7 +26,7 @@
+ typeahead-editable="false" on-return="add()" focus-on="foAccount"/>
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(); + }); } }); }