Creating New project
As you all new below command for generate a new project, but there are multiple flag you can set along with this command
ng new my-app
To create a new project with sass support
ng new project_name --style=scss
To create a new project using own prefix instead of app for component
ng new project-name --prefix myprefix
--dry-run
: See which files would be created, but don’t actually do anything.--skip-tests
: Don’t create spec files.--skip-git
: Don’t initialize a git repo.--source-dir
: Name of the source directory--routing
: Add routing to the app.--prefix
: Specify the prefix to use for components selectors.--style
: Defaults tocss
, but can be set toscss
.--inline-style
: Use inline styles for components instead of separate files.--inline-template
: Use inline templates for components instead of separate files.
These Commands also can be used while creating new component
Creating New Component
–skip-tests Do not generate spec file
ng g c new-component --skip-tests:
–inline-style or -is – Helps to create .ts file with inline styles
ng g c new-component -is
OR
ng g c new-component --inline-style
–inline-template or -it Helps to create .ts file with inline HTML template
ng g c new-component -it
OR
ng g c new-component --inline-template
Create customer component without any folder
ng g c customer --flat
Create Module with lazy loading
For Example Adding “customers-list ” with route path “customers” to app module
ng g module customers-list --route customers --module app.module
Build and Run
Builds your entire project and automatically opens the browser.
ng serve -o
Change port Builds your entire project and automatically the URL pointing to port 6600
ng serve -p 6600
ng add schematics
To add latest ng bootstrap to project
ng add @ng-bootstrap/schematics
To add latest ng Angular material to project
ng add @angular/material