https://docs.angularjs.org/api/ng/directive/ngClass 翻译 表达式生成一个空格饭分隔的class字符串 一个对象,它的每一个key在其值为true的时候作为class来用 一个数组,数组的项可以是第一种/第二种, 或者他们的混合 $scope.menuitems=[ {id: 1, state: "admin.user", text: "用户", icon: "glyphicon-user"},…
ng-class的使用几种方式 (1):利用双向数据绑定(className根据chang2的值去匹配类) <div class="{{className}}">............</div> $scope.className="change2"; (2):通过字符串数组的形式 <div ng-class="{true:'RED',false:'GREEN'}[className]"></div&g…
<some-element [ngClass]="'first second'">...</some-element> <some-element [ngClass]="['first', 'second']">...</some-element> <some-element [ngClass]="{'first': true, 'second': true, 'third': false}"…
[NgClass]  CSS 类会根据表达式求值结果进行更新,更新逻辑取决于结果的类型: string - 会把列在字符串中的 CSS 类(空格分隔)添加进来, Array - 会把数组中的各个元素作为 CSS 类添加进来, Object - 每个 key 都是要处理的 CSS 类,当表达式求值为真的时候则添加,为假则移除. <some-element [ngClass]="'first second'">...</some-element> <some-…
angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net/topic/12/post/2 系列目录 (1)组件详解之模板语法 (2)组件详解之组件通讯 (3)内容投影, ViewChild和ContentChild (4)指令 指令 大家应该都知道,在html中存在一些附加在元素节点上的标记,例如属性,事件等等.它们能够改变元素的行为,甚至操作DOM,改…
angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net/topic/12/post/2 系列目录 (1)组件详解之模板语法 (2)组件详解之组件通讯 (3)内容投影, ViewChild和ContentChild (4)指令 章节目录 1插值语法和表达式 2在模板内部定义变量 3值绑定,事件绑定,双向绑定 4内置结构型指令*ngIf,*ngFor,ng…
  1. 使用模块化写法. var app = angular.module('myApp', []); app.controller('TextController', function($scope) { $scope.txt = {'title':'some txt'}; }); [] 表示此模块不依赖其它模块. ng-model, ng-repeat, ng-change,ng-click(相当于onclick),ng-dblclick(相当于ondblclick)   ng-repea…
基础ng指令 ng-href ng-src ng-disabled ng-readonly ng-checked ng-selected ng-class ng-style ng-show ng-hide ng-repeat ng-init ng-if ng-bind ng-bind-template ng-cloak ng-model ng-click ng-change ng-submit ng-include 内置指令说明 a.ng-href 使用说明: 当使用当前作用域中的属性动态创建U…
1.属性指令 angularjs样式相关指令: ng-class ng-style ng-href ng-src ng-attr-(suffix) ng-bind ng-cloak  没解析完之前标签是隐藏的,解析完后标签是显示的,控制css的指令 ng-bind-template  支持多表达式'{{text}},{{text}}' ng-bind-html  解析字符串中的标签,需要依赖angular-sanitize.min.js ng-non-bindable  不解析表达式,就原样输出…
AngularJS特点 遵循AMD规范 不需要操作节点 对于jquery,一般是利用现有完整的DOM,然后在这戏Dom的基础上进行二次调教了:而对于AngularJS等框架则是根据数据模型以及其对应用dom模板,而后通过模板类似于搭积木那样组合页面. 不适合频繁dom操作的应用. {{}} Angular的表达式 借鉴mvc理念:仅仅只是借鉴,区别在于控制C,Angular弱化了控制器 mvvm vm:viewModel,$scope 是一个对象 官方解释 mvw w:whatever,$sco…