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

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=ngChange
at Error (native).....

Can anyone please help? Thanks in advance.

share improve 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

up vote 14 down vote accepted

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

share improve this answer
 

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

See working sample.

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

share improve this answer
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值