Setting up environment for Angular 6

1. Check if you have npm installed by opening command and type npm -v. If you have not installed npm download it from - https://nodejs.org/en/
2. Install @angular-cli. Type npm install -g @angular/cli. -g parameter means that package will be installed globally so you can access angular cli functionality from any location.
Visit -  https://cli.angular.io/ for more info. This will enable you to create new angular project with some basic data that follows good practices.
3.  Next create new angular project. Type ng new ng-project where ng-project is name of new project you want to create. Make sure that in command line you are in folder where you want this project to appear. You can also use optional parameters like --routing or --style=scss (will use scss by default instead of css)
4. Now you open source code by typing code  (make sure you type .) in command line if you have Visual Studio Code installed (https://code.visualstudio.com/) - highly recommended
5. To run app you just create type ng -serve -o to initiate localhost server and open app in a browser. If you see error message "The serve command requires to be run in an Angular project, but a project definition could not be found" make sure you are in your angular project main folder. 


Comments

Post a Comment