Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 1055 of the free egghead.io lessons, plus get Angular 2 content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Install the Angular CLI to Create and Serve an Angular Application

1:17 Angular 2 lesson by

Getting started with angular development can be difficult, with a lot of moving parts. Allow the Angular CLI to handle those complexities so you can focus on creating great applications.

In this lesson you will learn how to install the Angular CLI from npm, create a new application, serve the new application in the browser and edit it with live-reload.


egghead.io comment guidelines

Avatar
egghead.io

Getting started with angular development can be difficult, with a lot of moving parts. Allow the Angular CLI to handle those complexities so you can focus on creating great applications.

In this lesson you will learn how to install the Angular CLI from npm, create a new application, serve the new application in the browser and edit it with live-reload.

Install the Angular CLI from NPM, remembering to include the -g to indicate that you wish to install it globally. This will allow you to create applications outside the scope of any existing application.

With the instillation complete, verify the instillation by running ng--version. Now you know you have a proper instillation of the Angular CLI.

To create an application, type ng to activate the Angular CLI, new to indicate that you wish to create a new application, and then the name of the application you wish to create. In this case, I will use sample as the name of the application.

By creating a new application, we've also created a new directory with the same name of the application. From that directory, you can run ng-serve to compile the application and run it.

Take note that the application is running on local host port 4200.

With the application now being served, you can navigate to local host port 4200 in your browser to see the application running. The Angular CLI's ng-serve provides a live reload experience. Make a change to the app component in your editor, save the file, and see the changes reflected directly in your browser.


Featured course:

Building apps with Ionic 2

Building apps with Ionic 2

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?