如:app.controller("mainCtrl",['$scope',function($scope){
$scope.datas=[{"name":"tom","age":22},{"name":"mary","age":36},{"name":"john","age":63}];
// var arr=$scope.datas;
$scope.datas[0].country="China";
console.log(arr[0]);
}]);现在,我想给第二个对象,添加一个属性: "addr":"中国",,如何实现呢?下载这种方法,会出现 错误[ng:areq] Argument 'mainCtrl' is not a function, got undefined当去掉$scope.datas[0].country="China";,程序就正常了,说明这种写法不妥!如何写呢?
添加回答
举报
0/150
提交
取消