1、ng-app 根元素 最多一个
2、ng-modle 相当于vue.js的v-model
3、ng-init 指令初始化应用程序数据。
4、ng-repeat 指令会重复一个 HTML 元素 相当于v-for
5、ng-controller
6、自定义的指令 可通过元素名、类名、属性、注释
restrict:ECAM
template:内容
replace: 注释必为true
7、ng-show true false
8、input必须在form里才能进行验证
9、ng-model 为数据提供状态值 invalid是否合法 dirty 是否改变 touched 是否触屏点击
10、ng-bind: 将某个应用程序变量name绑定到某个个段落的innerHTML
11、ng-model指令可根据表单域的状态添加或移除以下类
ng-empty/ng-not-empty、ng-touched/ng-untouched、ng-valid/ng-invalid、ng-dirty、ng-pristine、ng-pending
12、$scope 作用域 可多个
$rootScope 根作用域 只能一个
13、过滤器
uppercase lowercase
currency currency:"RMB:¥"
number:n; 保留几位小数
filter 查找
limitTo: 正数:截取前几位 负数:截取后几位
orderBy:‘id’ 降序 后面加“true”
14、service 参数function
$location.absUrl() 地址
$http.get(url).then(function (response) {});
$http.post(url).then(function (response) {});
$timeout 服务对应了 JS window.setTimeout 函数。
$interval 服务对应了 JS window.setInterval 函数。
15、select
ng-repeat <option> 选中的只是一个值,而不是对象
ng-option="x for x in xx" 选中的是一个对象 x for (x,y) in xx ------x为key
16、表格 ng-repeat
css: nth-child(odd) :nth-child(even)
ng-if="odd/even" style="{{$even/odd}}?'css':''"
17、ng-disabled true 不可点击 false 可点击