更多教程请关注:
http://13.59.117.220/2017/07/18/angular2-tutorial-one-setup-a-basic-project/
In this tutorial i will teach your how to setup a basic Angular2 project.
We will use Angular CLI to help us setup the project.
Angular CLI is a great tool to start with Angular2 project since it can help us setup the project easily it provides lots of useful command.
You can find all possible blueprints in the table below:
Scaffold | Usage |
---|---|
Component | ng g component my-new-component |
Directive | ng g directive my-new-directive |
Pipe | ng g pipe my-new-pipe |
Service | ng g service my-new-service |
Class | ng g class my-new-class |
Guard | ng g guard my-new-guard |
Interface | ng g interface my-new-interface |
Enum | ng g enum my-new-enum |
Module | ng g module my-module |
So let start to make a new project name angular2TutorialOne by typing:
ng new angularTutorialOne
then you should see the output something like this:
as you can see all the basic staff is automatically done!
next let’s open this project using IDE.
In my case i love using WebStorm and of course you can use any IDE you like.
type: ng serve on you project base dir.
open your web browser and input : http://localhost:4200
That’s it!
conclusion
So far we have successfully setup a new angular2 project from scratch.
In the next tutorial i will introduce the basic structure of angular2 project.
happy coding!