angularjs : calling a function in select element -
How to call the function in the case below?
& lt; Select class = "dropdown" & gt; & Lt; Option ng-repeat = "group in my group" ng-model = "group.Name" ng-change = "myfunction (group.Id)" & gt; {{Group.Name}} & lt; / Option & gt; & Lt; / Select & gt; Ng-click will not work NG-model is required if you want to use ng-change (I do not need ng-model NG-change Also does not seem to call a function I know I can probably use NG model and $ watch, but since I don 'I really have a ng-model in this case I'm a little confused ... So, How do I call a function inside NG-Dual selection? (Its ng-selection is not as you might have seen)
OK, option then
selection is the value of the element. Try to do this:
& lt; select ng-model = "selected group" ng-change = "your function ()" & gt; & lt; option ng- Repeat = "group in my group" & gt; {{group.name}} & lt; / option & gt; & lt; / select & gt; existing scope < / Code> on up Numerology Like: scope.yourfunction = function () {Console.log (scope.selectedGroup); }; I also strongly recommend that you take a look at ngOptions .
Comments
Post a Comment