Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Install the Angular CLI to Create and Serve an Angular Application

    Mike BrocchiMike Brocchi

    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.

    angularAngular
    angular-cliAngular CLI
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:00 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.

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

    00:20 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.

    00:34 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.

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

    00:54 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.

    Discuss

    Discuss