How to Install Angular 6

How to Install Angular 6

The quickest and easiest way of starting an Angular 6 app is through the Angular CLI (Command Line Interface).
To install it, you're going to need either the yarn package manager or the node package manager. To check whether or not you have npm, in your console / command line, type:
> npm -v
If this goes unrecognized (and not a version number), you need to install NodeJS. Once you install NodeJS, reload your console or command line and you will have access to NPM.
Now, we can use NPM to install the Angular CLI. The Angular CLI has an official website located here.
To install it:
> npm install -g @angular/cli
If you run ng -v after installing, it will provide you with the version number. Mine happens to be 6.0.7.
Once the CLI is installed, we can now use it to start a install a brand new Angular 6 project:
> ng new ng6-proj --style=scss --routing
  • ng - This is how we call the Angular CLI.
  • new - This is one of the many commands we can issue to the CLI.
  • ng6-proj is simply the name that we're calling our project. The CLI will create a folder with this name, based on where you're running this command.
  • Optional flags - Next are two optional flags that I decided to add. First, we're telling the CLI to generate a project that has Sass enabled (by default, CSS is used if this is not specified), and then --routing is added because we want a project that has different page URL's, and adding this flag will help create a routing file for us.
To check out all of the available commands and options, run ng at the command line.
Once the CLI has generated the new project, you can hop into it:
> cd ng6-proj
If you use Visual Studio Code, you can type code . to launch the code editor. Then, to serve the project to the browser, you run:
> ng serve -o
The -o flag tells the CLI to launch your browser with the project. Now, you're able to watch your Angular 6 project as you code and it will automatically live reload. Awesome!
How to Install Angular 6 How to Install Angular 6 Reviewed by Pakainfo on August 08, 2018 Rating: 5

No comments:

'Heartbroken' family of Nigerian man who died at Calgary airport wants answers

'Heartbroken' family of Nigerian man who died at Calgary airport wants answers Bolante Idowu Alo died following altercation wit...

Powered by Blogger.