Getting Started With Angular

Getting Started With Angular

To start working with Angular we need to first set up the development environment.

A development environment is one that has everything installed and provides comprehensive facilities to developers for application development.

Good tools make application development quicker and easier to maintain than if you did everything by hand.

This article will guide you through the installation process of Angular-CLI with which you can quickly set stage for a basic Angular Application.

All we need is just a NPM(Node Package Manager) and Angular-cli.

Angular-CLI is hosted as a node_module and to install and use it you will need NodeJS and it’s package manager named npm(Node Package Manager). The Angular-CLI is a command line interface tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.

So let's get started and go through the installation process.

Step 1. Set up the Development Environment 

You need to set up your development environment before you can start to do anything with Angular. For this you need to install node.js and npm.

To install NodeJS, navigate to the Downloads Section of the NodeJS’ website, download and install the Installer, best supported by your OS. NodeJs comes with a pre-installed npm.

You can check the version of your NodeJs and npm by opening your command prompt, and typing : node -v and npm -v.

Now we have NodeJS and npm installed on our machines. It’s time to install Angular-CLI. And we can install it using npm and typing: npm install -g @angular/cli 

This will install the latest version of Angular-CLI, globally on your machine. It will take some time to install as it has to download all the node_modules it has a dependency on.

Once it is installed, you can verify if it was properly installed by typing: ng -v. And if it is properly installed, it should print a message like this on your command prompt.

Now we have tools like NodeJS, npm, and Angular-CLI, so we can go ahead and make an Angular Application.

Step 2. Create a new project 

To create a new angular project open a terminal window and generate a new project and default app by running the following command: ng new my-app

The Angular CLI installs the necessary npm packages, creates the project files, and populates the project with a simple default app. This can take some time.

Step 3: Serve the application 

To run the project on a local server in browser go to the project directory and launch the server.

The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.

Using the --open (or just -o) option will automatically open your browser on https://localhost:4200/.

The browser opens with the application:

Now that you have the basic boilerplate code for an Angular App, you can build your application on top of it. 

Note: To make your workings easier with Angular you can install an IDE like Visual Studio Code, Atom, WebStorm etc.

This brings us to the end of this article. I hope this article has enabled you to successfully install NodeJS and Angular-CLI. Now you are all ready to start working on your Angular Application.

Navneet Prakash

Senior Angular Developer

6 年

Thank you Nagma?for sharing your knowledge.

要查看或添加评论,请登录

Nagma Bano的更多文章

  • Angular Lifecycle Hooks

    Angular Lifecycle Hooks

    Angular Lifecycle Hooks are the different phases of the component from its creation to its destruction where we can…

  • Data Communication In Angular

    Data Communication In Angular

    Data sharing is one of the important concept to understand in Angular. How Angular communicates data from and to…

    4 条评论
  • Introduction to Data binding

    Introduction to Data binding

    Data-binding is the mechanism for coordinating the parts of a template with the parts of the component. You can achieve…

  • Modules in Angular

    Modules in Angular

    Modules are a great way to organize an application and extend it with capabilities from external libraries. NgModules…

  • Templating, Styling and Component Hierarchy in Angular

    Templating, Styling and Component Hierarchy in Angular

    In Angular, your views are defined within HTML templates. A template is a form of HTML that tells Angular how to render…

    1 条评论
  • Introduction to Components

    Introduction to Components

    The core concept of any Angular application is the component. In effect, the whole application can be modeled as a tree…

    1 条评论
  • Bootstrapping of the Angular Application

    Bootstrapping of the Angular Application

    Seeing the complexity of the Angular file structure, the first question that comes to the mind is how does it actually…

    1 条评论
  • Angular Architecture

    Angular Architecture

    The main building blocks of Angular are: Modules Components Templates, Directives, and Data Binding Services and…

    1 条评论
  • Angular Features and Benefits

    Angular Features and Benefits

    Angular is one of the most popular modern day web frameworks available today. Because of the sheer support of Google…

  • Angular6 Vs Angular5

    Angular6 Vs Angular5

    Angular 5 Angular 5 showed up on November 1, 2017 with the promise of speed and a smaller size. The key features of…

社区洞察

其他会员也浏览了