Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGavin Murphy
10,004 Pointsng-change problem
there seems to be a problem when i add ng-change(""). Every time I add it , everything in the itteration breaks down, I only get the first item and my edit button stops working. And when i remove ng-change it works perfectally. Please help!
4 Answers
Seth Kroger
56,413 PointsIf you're calling a function you need parentheses after the controller function name, so learningNgChange
should be learningNgChange()
.
Gavin Murphy
10,004 PointsThanks for the quick response man
I already tried that but I just realized that there are three typos
mg-modal supposed to be ng-model LOL
and model again further down.... so funny this has been wrecking my head for ages and as soon as i posted it i found the problem LOL
Gavin Murphy
10,004 Pointshttp://errors.angularjs.org/1.4.9/$compile/ctreq?p0=ngModel&p1=ngChange at Error (native) at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:6:416 at p (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:59:414) at I (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:62:213) at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:55:97) at I (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:62:114) at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:55:97) at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:54:239 at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:56:79 at k (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:60:378)
This is appearing in the console Maybe angular1.4.9 does not support ng-change ??
Gavin Murphy
10,004 PointsI already tried that but I just realized that there are three typos
mg-modal supposed to be ng-model LOL
and model again further down.... so funny this has been wrecking my head for ages and as soon as i posted it i found the problem LOL
Gavin Murphy
10,004 PointsThanks for the quick response man
Gavin Murphy
10,004 PointsGavin Murphy
10,004 Points<div class="item" ng-class="{'editing-item' : editing}" ng-repeat="todo in todos"> <input mg-modal="todo.completed" type="checkbox" /> <label ng-hide="editing" ngclick="helloWorld()">{{todo.name}}</label> <input ng-change="learningNgChange" ng-blur="editing = false;" ng-show="editing" ng-modal="todo.name" class="editing-label" type="text" />