Sharing Top Content from the Angular-sphere.

Difference Between Angular 2 And Angular 4

Difference Between #Angular2 And #Angular4 by @satheesh677 cc @CsharpCorner  #Angular

  • View Engine Size Reduced 

    There are some changes under the hood to AOT generated code compilation that means Angular 4, hasimproved the compilation time.

  • Now Angular has its own template tag that is called “ng-template”.
  • NgIf with Else 

    Now in Angular 4, it’s possible to use an else syntax as,

    AS keyword 

    A new addition to the template syntax is the “as keyword” which is used to simplify the “let” syntax.

  • To subscribe only once to a pipe “|” with “async” and if a user is observable, you can now use it to write

    Pipes 

    Angular 4 introduced a new “titlecase” pipe “|” and uses it  to change the first letter of each word into uppercase.

  • The example is,

    Http 

    Adding search parameters to an “HTTP request” has been simplified as,

    Test

    In Angular 4, overriding a template in a test has also been simplified as,

    Service

    A new service has been introduced to easily get or update “Meta Tags” i.e.

    Forms Validators 

    One new validator joins the existing “required”, “minLength”, “maxLength” and “pattern”.

Angular 4 applications are smaller & faster in comparison to Angular 2.

@CsharpCorner: Difference Between #Angular2 And #Angular4 by @satheesh677 cc @CsharpCorner #Angular

AngularJS 4 contains some additional features over Angular 2.

Smaller & Faster Apps 

Angular 4 application is smaller and faster in comparison to Angular 2.

View Engine Size Reduced 

There are some changes under the hood to AOT generated code compilation that means Angular 4, hasimproved the compilation time. These changes reduce around 60% of the size in most cases.

Animations now have their own package i.e. @angular/platform-browser/animations

Improvement 

Some Improvement on *ngIf and *ngFor.

Template 

The template is now ng-template. You should use the “ng-template” tag instead of “template”. Now Angular has its own template tag that is called “ng-template”.

NgIf with Else 

Now in Angular 4, it’s possible to use an else syntax as,

AS keyword 

A new addition to the template syntax is the “as keyword” which is used to simplify the “let” syntax.

To subscribe only once to a pipe “|” with “async ” and if a user is observable, you can now use it to write

Pipes 

Angular 4 introduced a new “titlecase” pipe “|” and uses it  to change the first letter of each word into uppercase.

The example is,

Http 

Adding search parameters to an “HTTP request” has been simplified as,

In Angular 4, overriding a template in a test has also been simplified as,

A new service has been introduced to easily get or update “Meta Tags” i.e.

One new validator joins the existing “required”, “minLength”, “maxLength” and “pattern”. An email helps you validate that the input is a valid email.

A new “compareWith” directive has been added and it used to help you compare options from a selection.

Router 

A new interface “paramMap” and “queryParamMap” has been added and it was introduced to represent the parameters of a URL.

CanDeactivate 

This “CanDeactivate” interface now has an extra (optional) parameter and it contains the next state.

The internationalization is a tiny improvement.

Difference Between Angular 2 And Angular 4

Comments are closed, but trackbacks and pingbacks are open.