Fix: The new focusing directive wanted exclusive scope and it conflicted at times. Fixed.
This commit is contained in:
parent
948b45b2ce
commit
9c70286258
@ -7,7 +7,7 @@
|
||||
<div class="col-md-10">
|
||||
<div class="input-group">
|
||||
<input class="form-control" id="txtDate" type="text" datepicker-popup="dd-MMM-yyyy"
|
||||
is-open="dOpen" ng-focus="dOpen = true" ng-model="voucher.Date" focus-on="foAccount"/>
|
||||
is-open="dOpen" ng-focus="dOpen = true" ng-model="voucher.Date"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
|
||||
</span>
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="col-md-4">
|
||||
<input type="text" id="txtAccount" class="form-control" ng-model="account"
|
||||
typeahead="account as account.Name for account in accounts($viewValue)"
|
||||
typeahead-editable="false" on-return="add()"/>
|
||||
typeahead-editable="false" on-return="add()" focus-on="foAccount"/>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="input-group">
|
||||
|
17
brewman/static/scripts/angular_directive.js
vendored
17
brewman/static/scripts/angular_directive.js
vendored
@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user