demohtml
<select name="" id="" class="form-control" [(ngModel)]="branchInsuranceCompanyId" (ngModelChange)="changeCompany()"> <option [value]="insuraceCompany.id" *ngFor="let insuraceCompany of insuraceCompanyList"> {{insuraceCompany.insurerName}} </option> <!-- <option value=""></option> --> </select> <btton class="btn btn-primary" type="button" (click)="getInjuryBasePriceList()"> <i class="fa"></i>收索 </btton>
angular2經常使用組件angular2
更多參見spa
http://www.cnblogs.com/1wen/p/5564368.html雙向綁定
功能code |
代碼參考orm |
{{屬性名}}htm |
數據綁定對象對象 {{insuraceCompany.insurerName}}blog |
(click)事件 |
標籤的點擊事件 (click)="getInjuryBasePriceList()" |
[(ngModel)] |
數據雙向綁定 [(ngModel)]="branchInsuranceCompanyId" |
*ngFor |
循環 *ngFor="let insuraceCompany of insuraceCompanyList" |
*ngIf |
<table *ngIf="movies.length">
|
ngModelChange |
select的change事件 (ngModelChange)="changeCompany()" |
[value] |
select的option value事件 [value]="insuraceCompany.id" |
[hidden] |
<h3 [hidden]="!favoriteHero"> Your favorite hero is: {{favoriteHero}}</h3>
|
ngClass/ngStyle |
頁面添加樣式控制 [ngStyle]="{color: colorPreference}" [style.color]="colorPreference"
|
ngSwitch |
頁面條件控制(狀態控制) <span [ngSwitch]="favoriteHero"> <p *ngSwitchWhen="true"> Excellent choice! </p> <p *ngSwitchWhen="false"> No movie, sorry! </p> <p *ngSwitchDefault> Please enter your favorite hero. </p> </span> |