照例先看效果
下面是這個例子的代碼:
<! doctype html> <html lang =“ en” ng-app =“ scapp”> <head> <head> <meta charset =“ utf-8”> <title> </title> </title> </title> <srips src =“ lib/angular.min.min.min.js” type =“ type =” type =“ ng-repeat =“ cont in content”> <input type =“ text” ng-model =“ con.num1” ng-change =“ changeNum1(con)”/> <input type type =“ text” text'text'ng-model =“ num2” num2“ value =“ con.num2”/> </div> </div> </body> <script> var app = angular.module(“ scapp”,[]).controller(“ sccontroller”,[“ $ scope”,function($ scope.num2 = 2; },{num1:1,num2:6,總計:$ scope.changenum1 =函數(con)總結
其實方法非常簡單,只需要在每個ng-repeat中傳入具體的每一個數據分組就可以實現,例如本例子中的ng-change="changeNum1(con)"<code/>這樣就實現了單獨的小的數據作用域的控制。
以上就是這篇文章的全部內容,希望對大家學習或使用angularjs能有所幫助,如果有疑問可以留言交流。 ,如果有疑問可以留言交流。