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="col-md-10">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input class="form-control" id="txtDate" type="text" datepicker-popup="dd-MMM-yyyy"
|
<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">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
|
<button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
|
||||||
</span>
|
</span>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="text" id="txtAccount" class="form-control" ng-model="account"
|
<input type="text" id="txtAccount" class="form-control" ng-model="account"
|
||||||
typeahead="account as account.Name for account in accounts($viewValue)"
|
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>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="input-group">
|
<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 {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
scope: {
|
|
||||||
focusOn: '='
|
|
||||||
},
|
|
||||||
link: function (scope, element, attrs) {
|
link: function (scope, element, attrs) {
|
||||||
scope.$watch('focusOn', function (value) {
|
scope.$watch(attrs.focusOn, function (value) {
|
||||||
if (value === true) {
|
if (value === true) {
|
||||||
//$timeout(function () {
|
var getter = $parse(attrs.focusOn);
|
||||||
element[0].focus();
|
var setter = getter.assign;
|
||||||
scope.focusOn = false;
|
setter(scope, false);
|
||||||
//});
|
$timeout(function () {
|
||||||
|
element[0].focus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user