Angular 1.x 升級到 Angular 2
原項目用ng1.5寫的,現在改成ng2.0了,踩了不少坑,不過都忘記了。
如果你也正好要做這個工作,正好看到這個文章,不妨參考下。
AngularJs 1.x -> 2.0
ng-repeat -> *ngFor
ng-show -> *ngIf [hidden] [style.display]=""
ng-class -> [ngClass]
ng-if -> *ngIf
ng-model -> [(ngModel)] + name=''
ng-click -> (click)
ui-sref -> routerLink="../{{p.ID}}"
myattr='x' -> attr.myattr='x'
另,<script>不再支持了,用System.Import(),我沒試過。

浙公網安備 33010602011771號