Get Selected Text Of Angular Ng-option Dropdown List
I have this drop-down list in my angular code:
Solution 2:
The easy way would be to loop through the locations
array every time the value changes and grab the name
property from the location whose id
matches $scope.cleaningServiceLocation
:
$scope.getName = function(id) {
for (var i = 0; i < $scope.locations.length; i++) {
if ($scope.locations[i].id == id) {
return$scope.locations[i].name;
}
}
return"";
}
Post a Comment for "Get Selected Text Of Angular Ng-option Dropdown List"