Install angular 4 using angular cli

Install angular 4 using angular cli
Reading Time: 2 minutes

Today, we are going to learn how to install angular 4 using angular cli. It is very simple to install, you have just use few commands and you are done installing new angular 4 app. You can install without command also that will take long time to do. so we will follow simple and legitimate method to install angular 4 app.

Why install angular 4 angular CLI not manual method

We are using angular cli method because it is very simple and it will give you all the files which you need to start developing angular app. If you just want to focus on developing app and not bothered about how to setup everything then you can angular CLI. If you get more time then you can try to setup everything on your own.

Steps to install angular 4

  • Install Node js and NPM
    Technically, we don’t need node js coding for developing angular 4 apps. It helps in creating server during development of apps. When the app is fully developed then we can just put the compiled HTML and js file to our hosting server. There we don’t need node js.
    NPM is used to download packages and JavaScript libraries.
    you can download node js by their offical site. Click here
  • Install angular cli
    angular cli is a package available in NPM. you can install this package by using command. Before you install. Please read prerequisites.
    npm install -g @angular/cli
    Read more about angular cli in it’s official documentation. Click here.
  • Install angular project
    After installing angular cli, now you can type below command in cmd to install angular new project.
    ng new PROJECT_NAME
    It will install angular 4 project and install dependencies.
    After this, you can go this directory and run the project.
    cd PROJECT_NAME
    ng serve
    This will run the project on this URL :- http://localhost:4200
    However, you can change the default host and port or just port by typing
    ng serve --host 0.0.0.0 --port 4201
    ng serve --port 4201
  • Finally, App runs in browser
    When you will open the  above URL in browser, you can see your app running. you can do any change you want in app component. The page will not reload. It will compile to js and show the instant changes during development.

Leave a Reply

Your email address will not be published. Required fields are marked *