您的位置:首页 > Web前端 > AngularJS

angularjs注意点

2016-04-07 18:14 531 查看
1、指令的名称要统一小写。

2、指令中require后的字符前面加^(shift+6)或?效果一样。
3、$rootScope中的S大写。
4、input是用于用户输入的,数据要从View传输到Controller中,而{{}}和ng-bind是用于从controller中得到数据然后显示在view中。
5、ng-show,ng-model中的数据不能加$scope。
6、ng-required,true的时候验证,false的时候不验证,ng-show无法影响他的验证。
7、
<label ng-repeat="option in result.sercice">
<input type="radio" ng-model="params.service" ng-value="option[0]">{{ option[1] }}
</label>
ng-value在使用radio类型的input时是必不可少的,尽量使用ng-value而不是value。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  angularjs