"This is my first command to you."
- Return of the King (2003)
The official tour of heroes tutorial on Angular's site is a good place to start; but I'm not gonna assume that you've finished that tutorial. In fact, I'm gonna assume quite the contrary. A clean slate.
However, I do recommend at least browsing through the official angular2 guide. It will help you get a sense of what we have to work through which will facilitate what psychologists call the chunking of ideas.
The style guide is also essential reading, because Angular is particularly anal about how you name your stuff.
The one thing I am gonna assume that you have node and npm configured on your machine.
We're ditching the quickstart approach and using Angular CLI -- a kickass tool which will give you a working application without having to write any boilerplate code. (Bear in mind, several developers discourage the use of CLI for large production-grade apps; but in this case we'll be just fine.)
Enough talk. Let's go.
Run the following command on your terminal.
npm install -g @angular/cli
After you install Angular CLI, forget about the npm
command. The ng
command is your new best friend.
Pick a name for your project. Creating it via CLI is dead simple. If the name you picked is dry-run
, you just need to type in:
ng new dry-run
It'll take a while to do its thing. Once its ready, just cd
to your shiny new folder and type:
ng serve
That's it.
Open your default browser. Go to localhost:4200.
You'll find your app up and running.
Tip: To run it on some other port than the default one, use the
port
flag. As in:
ng serve --port 8787
You should see a page that screams
You can skip ahead to Chapter 2 if you wanna jump right into coding. Or you could read on and explore the stuff that CLI has built for us.