Skip to content

Instantly share code, notes, and snippets.

@dantullis
Last active December 26, 2023 16:41
Show Gist options
  • Save dantullis/0d9bd22f62305803be3de057693d942a to your computer and use it in GitHub Desktop.
Save dantullis/0d9bd22f62305803be3de057693d942a to your computer and use it in GitHub Desktop.
Angular ng commands

Angular ng commands

Not inclduing those that are commonly in the package.json file

Create new angular application

ng new project-name --routing --style scss
ng new angular-client --routing --style scss

Create module with routing

ng generate module home --route home --module app

Create shared module and add to app module

ng generate module shared --module app

Generates the service seo

ng g s seo

Generates the customer class inside of the models folder

If the folder models doesn’t exist the CLI will create it

ng g cl models/customer

The same as ng g cl models/customer but for creating an interface

ng g i models/person

Generates the pipe init-caps inside of the shared folder

ng g p shared/init-caps

Generates the search-box directive

ng g d search-box

Create components

ng generate component home
ng generate component about
ng generate component contact

Install dependencies AND can update/create configs

ng add @scullyio/init

Less common or one offs

Installing Angular CLI

npm install -g @angular/cli

Check the current installed Angular CLI version

ng --version

Turn off analytics gathering

Not turned on by default anymore?

ng config --global cli.analyticsSharing undefined

ng analytics project off

ng analytics off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment