11

I have the following html form select statement

<select ng-change="setBillGroup()" ng-model="bill.groupId" class="span8" ng-options="d.id as d.name for d in groups"></select>

and the js

myApp.controller('myAppController', function($scope, myAppService) {

.....
function setBillGroup(){
 console.log("setBillGroup method called!");
    ......
 }

....
});

But for some reason the setBillGroup() never seems to get called when I select something or the other in the form.

1 Answer 1

27

You have to define the method in the scope.

$scope.setBillGroup = function(){
 console.log("setBillGroup method called!");
    ......
 };
Sign up to request clarification or add additional context in comments.

2 Comments

Wow! Never felt this dumb! Thank you!
Oh my god - just passed by, searching for a related problem - and the only thing I never checked, was wether the called function was in scope. THANK YOU SO MUCH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.