ALL YOU NEED TO KNOW ABOUT THE NEW ANGULAR 4.2

The all new AngularJS 4.2, is out of its egg shell and all the tech freaks are eager to crack the books of this Angular. So without dwindling time, let’s start counting all the new feathers in the crown of Angular 4.2.

AngularJS 4.2, ANIMATIONS

With its novel entry, Angularjs 4.2 has brought in the much awaited new wave of animation which permits reusable animations, full blown router level animation, and multi-element animations. This much-endeavored API feature equips its user to animate their Angular apps in never dreamt before manner.

The all new query function as introduced in this version permits query feature in the template. Apart from this, it also supports pseudo-selectors, which lines up few other interesting possibilities.

To quote, we can now easily animate elements in NgFor:

1-1

With the given animation:

2-1

Now, whenever an element will leave, removed from races array, it will fade out and vice versa.

Stagger is the other new add-on under the umbrella of animation. With this add-on, staggering animations can be created with ease.

3-1

A reusable animation is another new add-on, which can be used to override the default parameter. Here is an example of changeOpacity animation:

4-1

When the element is being animated, Angular will add a ng-animating class to the element. Apart from this, one can trigger child animations using the animateChild function. Lastly, we can inject AnimationBuilder to program animations and trigger them on demand.

Related: WHO SOUNDS LIKE A WINNER! – REACT or ANGULAR 2

TEMPLATES

Here is great news! Now it’s possible to use strictNullChecks in all your applications. The ! postfix operator is also now available:

The code generated from AOT compiler will include non-null assertion operator, allowing you to do strict null checking in your templates!

FORMS

The new Angular 4.2 has two new validators over and above the existing minLength, maxLength, email, and pattern: min and max, to help you ratify that the input is the value specified to the best of its level.

The information as on 17th June’17 states that the validators min and max have for the time being have been eradicated but will reappear in version 5.

TESTBED.OVERRIDEPROVIDER

TestBed called overrideProvider is the new method of this new version, which allows overriding a provider irrespective of its module/component. This feature is a very interesting add-on for developers who initially could only test in JiT mode. But not the testing can be done in AOT mode also.

FLUSH

Make use of the new feature flush instead of a tick to automatically pause the tests till all the macro task events have been cleared from the queue.

FIXTURE.WHENRENDERINGDONE

The new feature whenRenderingDone is useful to test components with animations.

ANGULARJS 4.2 IN A NUTSHELL

  • Inclusion of validators for min and max attributes
  • Ease of passing an element refers to the bootstrap method of an ApplicationRef, to bootstrap directly
  • Improved i18n tooling
  • AOT testing foundation laid
  • New compiler flag alwaysCompileGeneratedCode is available
  • Configure options and set input variables are available within animations
  • Reusable animations using animation()
  • Query for inner elements within animations
  • Staggering multiple elements is possible
  • Enabled queried elements
  • Synthesize a full-blown animation when routes change
  • Program to build/control an animation using AnimationBuilder

Angular-JS-4

Concetto Labs is a one of the best Web & Mobile App development company as well Angular Js Development that has developed a large number of Angular JS projects. Concetto Labs is the best place to hire angular js developer.

Ref: ALL YOU NEED TO KNOW ABOUT THE NEW ANGULAR 4.2

COMPARATIVE STUDY BETWEEN ANGULAR 1 AND ANGULAR 2

Angular JS also was known as “Angular.js” or “AngularJS 1.X” marked its birth in the year 2010, to ease out the building of complex and data-heavy web apps through JavaScript. At the time of launch Angular JS could boast of having three jewels glued to its glory:

  1. Inimitable fast code production
  2. Effortless testable piece of application
  3. Backstage support of Google

But technology is another term for continuous change or innovation. Thus came the good news of Angular JS 2, which is very much distant in nature to its elder JS 1. Let’s study the differences in detail with examples to ensure ease of understanding on part of every reader.

Angular JS 2 has better mobile acclimatization and excels in its performance.

When Angular JS 1 was being conceived, mobile support friendly mechanism was not taken into consideration, however, Angular 2 was thoroughly mobile supported. The use of Hierarchical Dependency Injection system and unidirectional tree based change detection in Angular 2 is a considerable performance backer.

1

Angular 2 offers wide range of language options

Angular 2 has ES5, ES6, and TypeScript or Dart languages to select from as opposed to Angular 1 which has limited options under its umbrella, namely ES5, ES6, and Dart.

Implementation of web standards in Angular 2

Angular 2 provides exceptional quality performance as compared to Angular 1, because of the implementation of web standards (components).

2

Ease of setup

In the easy setup of Angular JS, one has to only add reference library and it is good to go. Whereas Angular 2 is dependent on other libraries and hence has complex steps to follow, before the final green signal.

Gone are the days of Angular 1.x controllers and $scope

In Angular 2, controllers are replaced with “Components”. Angular 2 uses zone.js to detect the changes.

3

Way to define local variables

In Angular JS 2 local variables are defined using hash (#).

Change in structural directives syntax

In Angular 2 ng-repeat is replaced with *ngFor. In AngularJS 2 version “2.0.0-beta.17 instead of “#” use “let”.

Use of camelCase syntax for built-in directives

Angular 2 uses camelCase syntax for built-in directives. For example, ng-model is now ngModel.

HTML DOM element properties and events

Angular 2 directly uses HTML DOM element properties and events, because of which several Angular 1 built in directives has lost their application. For example, ng-href, ng-src, ng-show and ng-hide of Angular 1, were replaced with href, src and hidden of Angular 2.

Data binding directive replaced

In Angular 2, ng-bind used for one-way data binding in Angular 1 has been replaced with [property].

Angular 1.x, one-way data binding

<input ng-bind=”technology.name”></input>

Angular 2, one-way data binding

<button (click)=”doSomething()”>

Two-way data binding

In Angular 2, ng-model used for two way data binding in Angular 1 has been replaced with [(ngModel)].

Angular 1, two-way data binding,

<input ng-model=”technology.name”></input>

Angular 2, two-way data binding,

<input [(ngModel)]=”technology.name”></input>

Bootstrapping Angular Application

In Angular 1, there are two ways to bootstrap:  ng-app attribute and other via code.

6

In Angular 2, it is only ng-app

8

Ways of Dependency Injection

In Angular 2, dependency injection is used through constructors

Changed way of routing

In Angular 1 $routeProvider.when() is used for routing. In Angular 2 @RouteConfig{(…}) is used for routing.  ng-view in Angular 1 is replaced as <router-outlet> in Angular 2.

Concetto Labs is a one of the best Web & Mobile App development company as well Angular Js Development that has developed a large number of projects. Concetto Labs is the best place to hire angular js developer.