一:angularjs指令
1.ng-bindhtml
使用給定的變量或表達式的值來替換 HTML 元素的內容angularjs
<p ng-bind="{{text}}"></p>
2.ng-blurapi
HTML 元素在失去焦點時須要執行的函數(<a>
, <input>
, <select>
, <textarea>
支持)數組
<input ng-blur="pay()" />
3.ng-checked/ng-disabled安全
ng-checked設置複選框(checkbox)或單選按鈕(radio)的 checked 屬性
ng-disabled表達式返回 true 則表單字段將被禁用(<input>
, <select>
, 或 <textarea>
)app
<input type="checkbox|radio" ng-checked="flag" ng-disabled="flag"></input> //flag爲布爾類型
4.ng-classide
給 HTML 元素動態綁定一個或多個 CSS 類。函數
//寫法一 <div ng-class="home"></div> //寫法二 <div ng-class="{'red':flag,'green':'!flag'}"></div> //flag爲true則添加red類名,false則添加green類名
5.ng-clickui
<button ng-click="addpay($event)">OK</button> //$event爲當前元素的多種屬性
6.ng-repeatspa
<div ng-repeat="(index,item) in list"></div> // 每項值:{{item}} // 下標:{{index}}
<a>
元素指定連接<select>
列表中指定 <options>
詳情參考:http://www.runoob.com/angular...
二:angular指令
imageUrl 屬性:
<img [src]="imageUrl">
[disabled]當組件爲 isUnchanged( 未改變 ) 時禁用一個按鈕:
<button [disabled]="isUnchanged">按鈕是禁用的</button>
設置指令的屬性:
<div [ngClass]="classes">[ngClass]綁定到classes 屬性</div>
表格的colspan/rowspan
<table border=1> <tr><td [attr.colspan]="1 + 1">One-Two</td></tr> <tr><td>Five</td><td>Six</td></tr> </table>
[(NgModel)]
<input [(ngModel)]="currentUser.firstName">
NgIf
<div *ngIf="currentUser">Hello,{{currentUser.firstName}}</div>
NgFor
<div *ngFor="let user of users; let i=index">{{i + 1}} - {{user.fullName}}</div>
(click)
<button type="submit" class="btn btn-primary" (click)="hide()">肯定</button>
[(checked)]
<input type="checkbox" [(checked)]="checkflag">
common
NgClass NgComponentOutlet NgForOf NgIf NgPlural NgPluralCase NgStyle NgSwitch NgSwitchCase NgSwitchDefault NgTemplateOutlet
forms
CheckboxControlValueAccessor CheckboxRequiredValidator DefaultValueAccessor EmailValidator FormArrayName FormControlDirective FormControlName FormGroupDirective FormGroupName MaxLengthValidator MinLengthValidator NgControlStatus NgControlStatusGroup NgForm NgModel NgModelGroup NgSelectOption PatternValidator RadioControlValueAccessor RequiredValidator SelectControlValueAccessor SelectMultipleControlValueAccessor
router
RouterLink RouterLinkActive RouterLinkWithHref RouterOutlet