Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Say "Hello World" to Angular 2

    John LindquistJohn Lindquist

    The quickest way to get started with Angular 2 is to use the Angular CLI. The Angular CLI allows you to create new projects and startup a server in just a couple quick commands. This lesson shows how to install the cli, start the server, and make a simple change.

    angularAngular
    5 - 6
    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 with npm install -g, for globally, angular-cli. Give that some time to install, and then you'll have a command called ng, where you can say ng new and the name of your project. I'm going to name mine angular 2-fundamentals. Once that has run, you can change into that directory, angular 2-fundamentals. Once you're in this directory, if you type ng serve and hit enter, that's the Angular CLI command to start up a server with the project you just installed.

    00:34 Once this is ready, you'll see that the bundle is now VALID. So this server is available on localhost 4200. So let that run, and you'll see app works. To change this, you can go into your project. Just open it in any editor. This angular 2-fundamentals directory, go into src, app, app.component.ts, and you'll see this 'app works'. You can change this to whatever you want. I'm going to change it to 'Let's get started!'

    01:04 Hit save, and you'll see the browser will automatically refresh, and you'll see Let's get started!

    Discuss

    Discuss