Issue
I am using a popup in angularjs with a form.I am using a auto-completer as-
portfolio.directive('auto', function($timeout) { var names = ["john", "bill", "charlie", "robert", "alban", "oscar", "marie", "celine", "brad", "drew", "rebecca", "michel", "francis", "jean", "paul", "pierre", "nicolas", "alfred", "gerard", "louis", "albert", "edouard", "benoit", "guillaume", "nicolas", "joseph"]; return { restrict : 'A', require : 'ngModel', link : function(scope, iElement, iAttrs) { iElement.autocomplete({ source: names, onSelect: function() { $timeout(function() { iElement.trigger('input'); }, 0); } }); } }; });
it is working but the autocomplete box opens behind the popup. can any one suggest the solution?
Solution
Try this out
Html
<div ng-app='MyModule'>
<div ng-controller='DefaultCtrl'>
<input auto ng-model="selected">
selected = {{selected}}
</div>
</div>
script
function DefaultCtrl($scope) {
}
angular.module('MyModule', []).directive('auto', function($timeout) {
var names = ["john", "bill", "charlie", "robert", "alban", "oscar", "marie", "celine", "brad", "drew", "rebecca", "michel", "francis", "jean", "paul", "pierre", "nicolas", "alfred", "gerard", "louis", "albert", "edouard", "benoit", "guillaume", "nicolas", "joseph"];
return {
restrict : 'A',
require : 'ngModel',
link : function(scope, iElement, iAttrs) {
iElement.autocomplete({
source: names,
select: function() {
$timeout(function() {
iElement.trigger('input');
}, 0);
}
});
}
};
});
Answered By - Nidhish Krishnan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.