angularjs注意点

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。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章