How To Update To Angular 5?

How To Update To Angular 5? What Is Angular CLI?

The Angular CLI is a tool to initialize, scaffold and maintain the angular apps.

Before you Installing, will need to check Angular CLI and your project have dependencies that require Node 6.9.0 or higher, together with NPM 3 or higher.

Installation -
npm install -g @angular/cli


The Angular CLI will add reference automatically for components, directives and pipes in your apps “app.module.ts”.

ng help


How to Generating and serving an Angular project using development server?

Follow the below commons to generating and serving an angular project -
ng new YOUR-PROJECT-NAME
cd YOUR-PROJECT-NAME
ng serve


And after execute the command - ng serve, your project will automatically reload to “http://localhost:4200/”.

We can also configure the default HTTP host and port by the below commands-
ng serve --host 0.0.0.0 --port 3201


How To Generating Components, Directives, Pipes and Services in Apps?
Below commands are used to generating -
·       Component – [ng g component my-new-component]
·       Directive – [ng g directive my-new-directive]
·       Pipe – [ng g pipe my-new-pipe]
·       Service -  [ng g service my-new-service]
·       Class -  [ng g class my-new-class]
·       Guard  -    [ng g guard my-new-guard]
·       Interface  -[ng g interface my-new-interface]
·       Enum  -     [ng g enum my-new-enum]
·       Module  -  [ng g module my-module]

How To Updating Angular CLI?
If you are using Angular CLI lesser version, un-install Angular CLI packages and install new versions.

Global Package -
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest


Local project package -
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install


Running Unit Tests in Your Projects -
ng test


Tests will execute after a build is executed via Karma and it will automatically watch your files changes. You can run Tests a single time via --watch=false.

Some Additional Commands for Angular -
·       ng new
·       ng serve
·       ng generate
·       ng lint
·       ng test
·       ng e2e
·       ng build
·       ng get/ng set
·       ng doc
·       ng eject
·       ng xi18n

Stated Informed Angular 4 and Angular 5 Tutorials
I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.
^