install Angular in linux | Command | CLI

sudo apt-get install nodejs
sudo apt install npm (or sudo npm install npm@latest -g)
sudo apt install ng-common
npm install -g angular-cli //globlay installed command line interface(cli)
ng new PROJECT_NAME //create papplication without routing file

ng new angular --routing // create papplication with routing file

ng g c employee -it -is // create component with inline tempalte and inline style


ng serve projectname --open //start on brower with compile

ng generate service foldername\freeapi // if you want to add in a folder.

ng generate service freeapi // it  will be added on app folder

ng g class classes\posts //it will add in folder name classes


https://angular.io/cli/generate // all cli command

Sample Free Api :
https://jsonplaceholder.typicode.com/posts/1/comments


Error: More than one module matches. Use skip-import option to skip importing the component into the closest module

use below
ng generate component componentName --module=app.module

or

ng generate directive <name> [options]
ng g directive <name> [options]
 


Comments

Popular Posts