1 In Angular 4, a lot of improvements made to reduce the size of the AOT (Ahead-of-time) compiler generated code.
2 In Angular 2 only TypeScript 1.8 version was supported, whereas, in Angular 4, it supports TypeScript 2.1 and TypeScript 2.2 compatibility.
3 The Animation features are separated from @angular/core package and moved them to new packages. By this way, if we don't import animation packages into your application then the main bundle size will be reduced and gives the performance improvement. As I told you @angular/core package and moved them to new packages, so if you are using these packages in your Angular 2 application then at the time of moving from Angular 2 to Angular 4, we need to change the package reference as well.
4 In Angular 4, else block newly introduced. I mean, along with *ngif, we can use else block as well. Sample code as below:
In Angular 2 we were writing like,
<div *ngIf="yourCondition">
<h2>Condition true!</h2>
</div>
<div *ngIf="!yourCondition">
<h2>Condition false!</h2>
</div>
Now you can rewrite the same in Angular 4,
<div *ngIf="yourCondition; else myFalsyTemplate">
<h2>Condition true!</h2>
</div>
<ng-template #myFalsyTemplate>
<h2>Condition false!</h2>
</ng-template>
2 In Angular 2 only TypeScript 1.8 version was supported, whereas, in Angular 4, it supports TypeScript 2.1 and TypeScript 2.2 compatibility.
3 The Animation features are separated from @angular/core package and moved them to new packages. By this way, if we don't import animation packages into your application then the main bundle size will be reduced and gives the performance improvement. As I told you @angular/core package and moved them to new packages, so if you are using these packages in your Angular 2 application then at the time of moving from Angular 2 to Angular 4, we need to change the package reference as well.
4 In Angular 4, else block newly introduced. I mean, along with *ngif, we can use else block as well. Sample code as below:
In Angular 2 we were writing like,
<div *ngIf="yourCondition">
<h2>Condition true!</h2>
</div>
<div *ngIf="!yourCondition">
<h2>Condition false!</h2>
</div>
Now you can rewrite the same in Angular 4,
<div *ngIf="yourCondition; else myFalsyTemplate">
<h2>Condition true!</h2>
</div>
<ng-template #myFalsyTemplate>
<h2>Condition false!</h2>
</ng-template>
1 comment:
Hi wonderful information shared by you:)
some more ES6 interview question could be find here:
Post a Comment