Angular has released its latest version, Angular 6.0. In this article, we will look at the new features of Angular 6.0 and also set up a new project with the help of Angular CLI 6.0 and Visual Studio Code.
What’s New in Angular 6.0?
ng update: A new CLI command that will update your project dependencies to their latest versions.
ng add: Another new CLI command that will make adding new capabilities to your project easier.
Angular Elements: This is a new feature that allows us to compile Angular components to native web components which we can use in our Angular app.
element is deprecated: You can’t use <template> anymore inside of your component templates. You need to use <ng-template> instead.
Angular CLI now has support for creating and building libraries. To create a library project within your CLI workspace, run the following command:
ng generate library <name>
For example:ng generate library my-demo-lib
Angular Material Starter Components: If you run ng add @angular/material to add material to an existing application, you will also be able to generate three new starter components.
Material Sideman A starter component including a toolbar with the app name and the side navigation.
Material Dashboard A starter dashboard component containing a dynamic grid list of cards.
Material Data Table A starter data table component that is pre-configured with a datasource for sorting and pagination.
Angular CLI now has support for workspaces containing multiple projects, such as multiple applications and/or libraries.
The “.angular-cli.json" file has been deprecated. Angular projects will now use "angular.json" instead of ".angular-cli.json" for build and project configuration.
Angular 6 will also allow us to use RxJS V6 with our application.
Tree Shakable Providers: Angular 6.0 allows us to bundle services into the code base in modules where they are injected. This will help us to make our application smaller.
For example, in previous Angular versions, we used to reference our services as below: