angular.js - angularjs如何给对象加一个属性呢,在js中?
天蓬老师
天蓬老师 2017-05-15 17:02:12
0
2
472

例如,我在jsp或者html文件中如此写一个作用域:
<input type="text" ng-model="bb.hello"/>

然后在js中,我如果想给bb添加一个属性该如何写呢?

在js中,如果直接写

bb.a="sdfd";
就回报错的。
那么该如何写符合这种东西呢?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
大家讲道理
 
$scope.bb.a = "sdfd";
Ty80

As far as writing is concerned, if a variable in HTML, such as bb, reaches the controller, it needs to be preceded by $scope., which is $scope.bb.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!