Answer the question
In order to leave comments, you need to log in
How to add typeahead directive dynamically?
Good afternoon.
I need to dynamically add the directive https://angular-ui.github.io/bootstrap/#/typeahead inside my directive by some condition.
To do this, I use $compile and a line with the directive
<input type="text" ng-model="asyncSelected" placeholder="Locations loaded via $http" uib-typeahead="address for address in getLocation($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults" class="form-control" typeahead-show-hint="true">
var a = angular.element(document).find('asd');
a.append($compile('<input type="text" ng-model="asyncSelected" placeholder="Locations loaded via $http" uib-typeahead="address for address in getLocation($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults" class="form-control" typeahead-show-hint="true">')($scope));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question