I use both Bootstrap and AngularJS in my web app. I’m having some difficulty getting the two to work together.
I have an element, which has the attribute data-provide="typeahead"
<input id="searchText" ng-model="searchText" type="text"
class="input-medium search-query" placeholder="title"
data-provide="typeahead" ng-change="updateTypeahead()" />
And I want to update the data-source attribute when the user inputs in the field. The function updateTypeahead is triggered correctly, but I don’t have access to the element that triggered the event, unless I use $('#searchText'), which is the jQuery way, not the AngularJS way.
What is the best way to get AngularJS to work with old style JS module.
will not pass DOM element to the function
updateTypeahead(this). Herethiswill refer to the scope.If you want to access the DOM element useupdateTypeahead($event). In the callback function you can get the DOM element byevent.target.