之前js判断未定义的对象都是用原生JS判断是否等于undefined
最近惊喜的发现angular已经此类方法,
所以记录一下
1、判断是否未定义:
angular.isUndefined()
2、时间格式化:
{{obj.processTime |date:'yyyy-MM-dd HH:mm:ss'}}
3、判断是否显示:
ng-show="obj.state==1" 如果state为1 则显示
Angular2常用到的事件:
select的change事件 ngModelChange
<select aria-describedby="expertist" class="form-control" [(ngModel)]="branchInsuranceCompanyId" (ngModelChange)="changeCompany()"> <option *ngFor="let insuraceCompany of insuraceCompanyList" [value]="insuraceCompany.id"> {{insuraceCompany.insurerName}} </option> </select>点击事件
(click)
<button type="button" class="btn btn-primary" (click)="getInjuryBasePriceList()"> <i class="fa fa-search"></i>搜索 </button>