Currently, I am attempting to integrate jQuery Geocomplete into my AngularJS application.
This is the section of code in my HTML file:
<input id="destination-location-input" type="text" class="form-control"
ng-model="destCtrl.destination" ng-change="destCtrl.locationChanged()"
data-geocomplete="street address" required/>
I have also implemented this piece of code in my controller:
var myElement = angular.element( document.querySelector('#destination-location-input'));
myElement.geocomplete(
{
appendToParent: true,
onChange: function(name, result) {
var location = result.geometry.location;
},
onNoResult: function(name) {
console.log("Could not find a result for " + name)
}
});
Upon running my application, I encountered the following error message:
TypeError: myElement.geocomplete is not a function
I am unsure about the root cause of this issue. Any ideas on what might be causing this problem?