Command list
| name | function | | ng init | Create the app in the current directory | | ng new | Create a new directory and run the ng init command under the new directory | | ng serve | initiate | | ng doc | Open the Angular document in your browser and search for the current keyword | | ng e2e | Use Protractor to run E2E tests in your current app | | ng format | Use clang-format to format the current project code | | ng generate | Build new code in your project | | ng g | Short for ng generate | | ng build | Build the project | | ng github-pages:deploy [options] | Deploy your project to GitHub Pages | | ng version | Output CLI version, node version, and operating system information | | ng set | Set up the environment | You can add --help after any command to see help
ng new
| Parameter name | type | Default | function | | --dry-run | boolean | false | Only outputs the files to be created and the actions performed, not actually creating the project | | --verbose | boolean | false | Output details | | --link-cli | boolean | false | Automatically connect to the angular-cli package | | --skip-install | boolean | false | npm install is not performed when the project is first created | | --skip-bower | boolean | true | Do not install the bower | | --skip-git | boolean | false | Git repository initialization is not performed | | --directory | string | Directory name | The default is the same as the project name | | --source-dir | string | 'src' | Source file directory name | | --style | string | 'css' | Write CSS with ('css', 'less' or 'scss'). | | --prefix | string | 'app' | Generate a prefix for a new component | | --mobile | boolean | false | Generate a Progressive Web App (PWA) project | | --routing | boolean | false | Add a module with routing and import it into the main app module | | --inline-style | boolean | false | When building a new application, use inline styles (inline, not generating a separate CSS file). | | --inline-template | boolean | false | When building a new application, use inline templates (inline, not generating a separate HTML file). | | --ng4 | not | not | After upgrading angular-cli to version 1.5 or above, NG5 is created by default |
ng serve
| Parameter name | type | Default | function | | --host | string | 12.0.0.1 | Custom configuration IP | | --disable-host-check | -- | -- | Following --host, allows projects to be opened with a host other than localhost | | --port | number | 4200 | Custom port number | | --live-reload-port | number | 4200 | Overload port numbers from time to time | | --hmr | -- | -- | Hot replacement |
ng generate
| name | example | | Component | ng g component my-new-component | | Directive | ng g directive my-new-directive | | Pipe | ng g pipe my-new-pipe | | Service | ng g service my-new-service | | Class | ng g class my-new-class | | Interface | ng g interface my-new-interface | | Enum | ng g enum my-new-enum | | Module | ng g module my-module | | Route | ng g route my-route is currently disabled |
command parameter ng generate class
| Parameter name | type | Default | function | | --spec | boolean | false | Generate the corresponding unit test file |
ng generate component
| Parameter name | type | Default | function | | --flat | boolean | false | Generate the component file in src/app, not in the current directory | | --inline-template | boolean | false | Use an inline template, not a standalone HTML file | | --inline-style | boolean | false | Use inline styles instead of standalone CSS files | | --prefix | boolean | true | Generate a component selector using the prefix specified in the angular-cli.json (the prefix indicates the first word of the selector) | | --spec | boolean | true | Generate the corresponding unit test file |
ng generate directive
| Parameter name | type | Default | function | | --flat | boolean | false | Generate the component file in src/app, not in the current directory | | --prefix | boolean | true | Default true, use the prefix specified in the angular-cli.json to generate the component selector (the prefix indicates the first word of the selector) | | --spec | boolean | true | Generate the corresponding unit test file |
ng generate module
| Parameter name | type | Default | function | | --routing | boolean | false | Add a routing module corresponding to the module and import it into the module | | --spec | boolean | false | Used to detect the presence or absence of a module |
ng generate service
| Parameter name | type | Default | function | | --flat | boolean | true | Generate the component file in src/app, not in the current directory | | --spec | boolean | true | Generate unit test files |
ng build
| Parameter name | type | Default | function | | --aot | string | not | Precompiled | | --base-href | string | ‘/’ | Set the base href parameter in the index.html file | | --environment | string | dev | In which environment is used, prod stands for build environment | | --output-path | string | dist | The file output destination path | | --target | string | development | development:默认值,不压缩混淆,production:压缩混淆代码 | | --watch | boolean | false | In which environment to use |
ng github-pages:deploy
| Parameter name | type | Default | function | | --message | string | not | The message submitted during the build must be written in quotation marks | | --target | string | development | The environment in which it is used | | --user-page | boolean | false | Whether to deploy to GitHub as a user/org page | | --skip-build | boolean | false | Skip the build and deploy directly | | --gh-token | string | not | Use Github's token | | --gh-username | string | not | Use your Github username | | --base-href | string | '/' | The base href value used in the index.html file |
ng set
| Parameter name | type | Default | function | | --global | -- | not | Whether to set the global or not | | packageManager | string | not | npm\cnpm\yarn |
For more command parameters, please refer to the official website:The hyperlink login is visible.
|