You are actually super close! There were just two small errors holding you back:
1) In JavaScript, line 34. `$scope.isngChange = true` should be `vm.isngChange = true`. 2) In HTML, line 6. `ng-change="parentSelected(vm.selectedParentItem)"` should be `ng-change="vm.parentSelected(vm.selectedParentItem)"`. Notice how I've called `parentSelected` on `vm`. Enjoy! On Wed, Jan 22, 2014 at 10:39 AM, JF <[email protected]> wrote: > Hi, > > I'm trying to use ngChange on a select, but my function is never called > when using the Controller As syntax. > > fiddle sample. <http://jsfiddle.net/jfcantin/v5tG6/3/> > > I'm not sure if I am doing the right thing, or if I'm missing something. > It works fine when you use the non "controller as" syntax. > > ngChange documentation states that it needs an ngModel to work, but there > was not mention of $scope being required. > > Or should I just skip ngChange altogether and use $scope.$watch? > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
