While using Angular 7.x if we need to create new component we use following command at terminal (I am using VS Code)
ng generate component "component name"
Above command will generate new component along with its folder under app with component name. Also it will add entry to app.module.ts file under import section & under NGModule section as well.
However, if we need to create new component without create a separate folder for component (can be used as nested component) then in terminal window first I need to get into path of component where I need to create nested component and then run following command:
ng generate component "component name" --flat
If, we need to create inline style and inline template for nested/component then we have to use following command:
ng generate component "component name" --flat -inline-style -inline-template
Or we can use short keys for above command as :
ng g c "component name" --flat -is -it
ng generate component "component name"
Above command will generate new component along with its folder under app with component name. Also it will add entry to app.module.ts file under import section & under NGModule section as well.
However, if we need to create new component without create a separate folder for component (can be used as nested component) then in terminal window first I need to get into path of component where I need to create nested component and then run following command:
ng generate component "component name" --flat
If, we need to create inline style and inline template for nested/component then we have to use following command:
ng generate component "component name" --flat -inline-style -inline-template
Or we can use short keys for above command as :
ng g c "component name" --flat -is -it
0 comments:
Post a Comment