Highlights on new elements of Angular 6

Posted By : Palak Sharma | 29-Jul-2018

Angular 6, as we all know is the latest and advanced version of Angular Family. We can easily update our old packages and create new elements in it. Below is the list of elements:-

 

1) ng add:- ng add is similar to npm install, it helps us in adding the new package in angular apps.

ng add angular/elements

 

2) ng update:- It is used to update the existing packages in the node modules. Suppose, if we want to update from Angular 5 to Angular 6, it will reduce a lot of effort.

ng update angular/core

 

3) Earlier we have to provide any services in providers array in app.module.ts, in order to register that particular service. Now, in Angular6, you can provide any services in it parent class only but putting the providedIn: root property with @Injectable Decorator.

 import {Injectable} from '@angular/core'

@Injectable{(
   providedIn:'root'
)}

4) We can use ng-template instead of template to render the HTML and it works for structural directives ngFor and ngIf

So , to conclude , we can take advantage of these extra features which are added in Angular 6. This will make our life easier.

About Author

Author Image
Palak Sharma

Palak is enthusiastic and passionate about coding , Her areas of expertise in coding languages are JavaScript and angular , html and css .

Request for Proposal

Name is required

Comment is required

Sending message..