• Home
  • Categories
  • Video Tutorials
    • Angular 5
  • News
  • About us
  • Contact us
  • Login
test
Code4Developers

Code4Developers

Code4Developers
  • Home
  • Categories
  • Video Tutorials
    • Angular 5
  • News
  • About us
  • Contact us
  • Login
  • Angular

Angular 4 Installations

  • Nisarg Dave
  • June 14, 2017
  • 3 minute read
Angular
Total
0
Shares
0
0
0

Introduction

This article demonstrates how to install Angular 4 in your local system and start working with angular/cli using basic commands.

What is Angular 4?

Before starting with Angular 4, we need to know about Angular 2. Angular 2 is totally different kind of framework from Angular 1.

Angular 1 is based on MVC structure and used to do two-way data binding, whereas Angular 2 is based on components. For every single task, we need to create component. Angular 4 has same concept and same structure as Angular 2 but better in performance. We can create component, directives, services in Angular 4 same as Angular 2.

Before starting with Angular 4

Go to URL https://cli.angular.io .

Angular given us Angular cli , which contains bunch of commands in order to work with Angualar project.  Before star working in Angular 4, Need to have NPM installed in your system.NPM stands for Node Package Manager.When you install Node.js , it will automatically add NPM in your system.

Make sure for running Angular 4 in your system , You must have latest version of Node.js which is 6.10 right now or atleast 6.9. Also you have to upgrate NPM version 3.10 or greater in your system.

 

Node.js  Command Prompt

Open Node.js command prompt and check for Node.js installed or not using command.

node -v

Also check for NPM latest version on your system using command.

npm –v

Now on https://cli.angular.io  few commands are available to install angular/cli. These commands help us to create and manage Angular 4 projects.

Step 1 : Install angular/cli using command.

npm  install  –g  @angular/cli

It will take few minutes to install as per your system speed.

Here –g means angular/cli will be installed and available for every project in your system.

If you not include –g , it will install in specific folder and only available for specific project.

Step 2 : Now check angular/cli installed in your system or not using command.

ng –v.

This will show cli version, node version and OS version of your system.

Step 3 : Now you are good to go for writing with Angular 4 in specific directory. In node command prompt, create project using below mentioned command.

ng new ProjectName    For ex.  ng new Angular4Demo

This command will create all the require packages for running Angular 4 application.

Now go into the ‘Angular4’ directory. We can see project call ‘ANGULAR4DEMO’ along with node_modules.  Here node_modules contains all the packages for automating the task for manage front end and back end of our Angular 4 application. It also contains various library and packages.

Open project in editor. Here I am using visual studio Code as editor.

you can see all the dependencies added in package.json file are belong from Angular 4.

Now navigate to the Angular4Demo folder in command prompt and write ng serve to run project.

This command will compile your code and prepare browser for running application. Generally it will run on http://localhost:4200/. So navigate in browser.

If you want to modify port uses below mention command.

ng  serve --host 0.0.0.0 -port 4201

Now your application will run on http://localhost:4201/ .

It is very useful to create Angular 4 application using angular/cli as we can get well defined folder structure.

Navigate to src folder, you can find index.html file. You can change code in this flie and save, browser detects the changes and automatically reloads the page and you can find your change.

 

Summary

In this article, I discussed how to start angular 4 and create sample application using angular/cli. We also saw the basic commands of angular/cli to run application and how to change the default port of our angular application using angular/cli.

Nisarg Dave
Nisarg Dave

He works as a software developer. He has hands-on experience on .net and other Microsoft technologies. He also works on AngularJS, KnockOutJS.

Views: 10,688

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on X (Opens in new window) X
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Like this:

Like Loading...

Related Posts

Total
0
Shares
Share 0
Tweet 0
Pin it 0
5 comments
  1. Karangiri says:
    June 14, 2017 at 10:55 pm

    It’s nice post

    Reply
  2. mittal says:
    June 15, 2017 at 5:08 pm

    Great article.. its quite nicely written and explained.

    Reply
  3. Pingback: Angular 4 Project Structure - Code 4 Developers
  4. Pingback: Pipes in Angular Part - 1 | Angular Pipes | Code4Developers
  5. Pingback: Angular 4 Project Structure - Code4Developers

Leave a ReplyCancel reply

Subscribe to Website via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts
  • React Hooks Guide: Top Tips for Optimizing Performance in Your React Applications

    React Hooks Guide: Top Tips for Optimizing Performance in Your React Applications

    1 year ago
  • Demystifying JavaScript Tree Shaking: Boosting Performance and Reducing Bundle Size

    Demystifying JavaScript Tree Shaking: Boosting Performance and Reducing Bundle Size

    2 years ago
  • Unlocking the Power of React Hooks: A Comprehensive Guide with Examples

    Unlocking the Power of React Hooks: A Comprehensive Guide with Examples

    2 years ago
  • Celebrating a Decade of Phenomenal Growth: Insights and Reflections on 10 Years of Software Engineering

    Celebrating a Decade of Phenomenal Growth: Insights and Reflections on 10 Years of Software Engineering

    2 years ago
  • Angular Custom Elements: Creating Reusable Components with Angular

    Angular Custom Elements: Creating Reusable Components with Angular

    2 years ago
  • Connect Firebase Realtime NoSQL Database with Angular App from Scratch

    Connect Firebase Realtime NoSQL Database with Angular App from Scratch

    5 years ago
  • How to Build an Inclusive Esports Community

    How to Build an Inclusive Esports Community

    5 years ago
  • Best Digital Icebreakers

    Best Digital Icebreakers

    5 years ago
  • Email alerts when a docker container stopped in AWS ECS CLUSTER

    Email alerts when a docker container stopped in AWS ECS CLUSTER

    5 years ago
  • New Learning Models for Fall 2020

    New Learning Models for Fall 2020

    5 years ago
Subscribe to Website via Email

Enter your email address to subscribe to this website and receive notifications of new posts by email.

Featured Posts
  • javascript 1
    Spread syntax (three dots) in JavaScript
    • March 21, 2018
  • Angular 2
    Angular 6 CRUD – Part 1: Project Setup, Routing, Service
    • May 9, 2018
  • javascript 3
    Local Storage and Session Storage
    • May 22, 2017
  • Angular 4
    Angular 4 Project Structure
    • June 18, 2017
  • AWS 5
    Email alerts when a docker container stopped in AWS ECS CLUSTER
    • July 24, 2020
Code4Developers
Learning is never ending process

Input your search keywords and press Enter.

 

Loading Comments...
 

    %d