照例先看效果
下面是这个例子的代码:
!DOCTYPE html html lang=' en ' ng-app=' scApp ' head meta charset=' UTF-8 ' title/title script src=' http : lib/angular。量滴js ' type=' text/JavaScript '/script/head body ng-controller=' scController ' div ng-repeat=' content in con '输入类型=' text ' ng-model=' con . num 1 ' ng-change=' change num 1(con)'/输入类型=' text ' ng-model=' controller(' scController ',['$scope ',function($ scope){ $ scope。num 2=2$scope.content=[ { num1:1,num2:3,total:3,},{ num1:2,num2:3,total:6,},{ num 13:1,num2:6,total 3:6,}];$ scope。changeno m1=函数(con){ con . total=con . num 1 * con . num 2;};$ scope。change total=function(con){ con . num 1=con . total/con . num 2;} }])/脚本/html总结
其实方法非常简单,只需要在每个尼日利亚重复中传入具体的每一个数据分组就可以实现,例如本例子中的ng-change=' changeno m1(con)'代码/这样就实现了单独的小的数据作用域的控制。
以上就是这篇文章的全部内容,希望对大家学习或使用AngularJS能有所帮助,如果有疑问可以留言交流。