The ng-cli is a command line tool for Angular. It gives you:
- Generators to build new projects and components.
- A server, to serve your app in development and production.
- Live reload.
- A test runner for unit, and E2E tests.
- A build tool, with minifation and cache busting.
npm install @angular/cli -g
Now create a new app with
ng new myapp
start a server with:
cd myappng serve
Viewing in a browser
http://localhost:4200/ to check your work in a browser. This is a live-reloading server, so any change you make is immediately visible.
You can generate new components using:
ng generate component cats
This will make you a new cat-component, complete with tests and templates.
Likewise for services, directives, etc.
Find the full documentation here: https://github.com/angular/angular-cli/wiki
Exercise - Hello World
Use the ng-cli to build yourself a simple hello world app.
Exercise - Attack the Dungeon
Generate an attack the dungeon app. Port your code over to it. For good measure, add a header, footer and some styling.