I'm having a problem on event listener of angular-chosen.
HTML Code:
<div ng-click="selectedLocation()"><select chosen ng-model="location" ng-click="stopPropagation($event)" ng-options="location.id as location.name for location in locations"><option value="">Location</option></select></div>
Javascript Code:
$scope.selectedLocation = function () {alert("Click Selected"); // show alert on click select chosen}
$scope.stopPropagation = function (event) {event.preventDefault(); //not workingreturn event.stopPropagation(); //not working}
I tried other events but it didn't work: ng-focusng-mousedownng-mouseenter
What you're probably looking for is ng-change on <select> instead of that wrapping ng-click. Also, this is not a bug in angular-chosen. You should go to stack overflow for generic angular questions.
Hello!
I'm having a problem on event listener of angular-chosen.
HTML Code:
<div ng-click="selectedLocation()">
<select chosen ng-model="location" ng-click="stopPropagation($event)" ng-options="location.id as location.name for location in locations">
<option value="">Location</option>
</select>
</div>
Javascript Code:
$scope.selectedLocation = function () {
alert("Click Selected"); // show alert on click select chosen
}
$scope.stopPropagation = function (event) {
event.preventDefault(); //not working
return event.stopPropagation(); //not working
}
I tried other events but it didn't work:
ng-focus
ng-mousedown
ng-mouseenter
Please help me solve this problem. Thank you!