Create your first Angular 4 / Angular 2 Project
For Angular 4 Quickstart video tutorial please scroll down.
Angular has it's own CLI which can be used to handle all the files and project.
Install Angular CLI
To install it you need NodeJS and no that does not mean that you need to learn anything about NodeJS it's going to be just a quick tool to handle both the Angular installation and having your project handled on browser, and the dependencies for you, in a different word it will be used to create a server medium for your project, again you don't need to know anything about it.
- Download the installer from Node.JS website.
- Choose the right match for your operating system.
- Follow the installation wizard.
- Open CMD and test the installation by running 'npm -v', you should get an output with the installed version.
Create your first project steps:
#1 Go to Windows CMD or Linux command line ..etc, then run the below commands:
npm install -g @angular/cli "node package manager"
ng new my-first-app "that creating the project for you"
ng serve "serve is the command which will compile the project for you and run the server to have your project running under localhost"
While creating new project spaces are not allowed, ex.: "test app" is not allowed and only "test-app" or similar can pass the ng new requirments.
Run your Angular project on localhost but which port ?
Now to run your first project, just cd to it after creating it and then type "ng serve" it will show the port number once you run the ng serve, and by default it's 4200 unless you change it.
Got errors while running ng serve ?
If it's a address or port error , try to use different port:
ng serve --port anotherPort