I am currently attempting to utilize the bs-typeahead directive from angular-strap.
* Latest Update *
I am hoping to have a function triggered when a user selects an option. However, I am encountering an issue in this straightforward scenario and receiving the following error:
Uncaught ReferenceError: myFunction is not defined
Below is the syntax I'm using:
Template
<input type="text" class="form-control" ng-model="selectedState" bs-options="state for state in states" bs-on-select="myFunction()" placeholder="Enter state" bs-typeahead>
JavaScript:
$scope.myFunction = function(){
console.log("This function is executed.")
console.log($scope.selectedState);
}
If anyone could assist me in determining what might be missing or incorrect, I would greatly appreciate it.
Here's the link to my plunker example: http://plnkr.co/edit/Z89TQ027WzxQn6UDJfAL?p=preview