ng-change is throwing error [$compile:ctreq]

来源:互联网 发布:c5 aircross 知乎 编辑:程序博客网 时间:2024/06/17 08:02

ng-change is throwing error [$compile:ctreq]

up vote6down votefavorite
3

I am using angularjs 1.2.14, the code is working fine without ng-change. As soon as i add the code for ng-change in checkbox. it throws the error.

Error: [$compile:ctreq] http://errors.angularjs.org/1.2.14/$compile/ctreq?p0=ngModel&p1=ngChangeat Error (native).....

Can anyone please help? Thanks in advance.

shareimprove this question
 
 
Please, provide more information. For example, JSfiddle or Plunker. –  Artyom Pranovich Mar 14 '14 at 11:23
 
Or at least provide the code ? Unless you believe that ng-change is broken in 1.2.14 (which is clearly not the case), it is quite remarkable that you want us to find the error in your code without providing the code ! – ExpertSystem Mar 14 '14 at 11:28
 
I tried to write a sample code for you which is smaller version of my actual code. But it is having some other error. You can see the code jsfiddle.net/fzS6L I am very new to AngularJS so i am not sure where am i getting wrong. Any help will be appreciated. –  mulla.azzi Mar 14 '14 at 11:36 

2 Answers

activeoldestvotes
up vote14down voteaccepted

to use ng-change in your element you should also specify ng-model which i had missed. Thanks for your time.

shareimprove this answer
 
up vote2down vote

http://plnkr.co/edit/oF8o6kU7zBDaJg4ts6TU?p=preview

See working sample.

ng-change requires ng-model, without it will not work

shareimprove this answer
0 0
原创粉丝点击