无法在angular6.1.1中使用属性inline-template和inline-styles生成组件

时间:2018-07-30 10:02:49

标签: angular angular-ui-router

我已经在Ubuntu-18机器上安装了Angular6,

我由ng new project --routing创建的项目

然后我想生成具有内联样式和内联模板的组件

我的命令是ng g c microsoftroute -it -is

但是它在终端中给出了错误,

ng g c microsoftroute -it -is
Schematic input does not validate against the Schema: {"inlineStyle":true,"inlineTemplate":true,"i":[true,true],"changeDetection":"Default","styleext":"css","spec":true,"flat":false,"skipImport":false,"export":false,"entryComponent":false}
    Errors:

  Data path "" should NOT have additional properties(i).

在此之前,我使用的是最新版本的anular6, 我的ng -v的输出为

ng -v
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|                |___/

Angular CLI: 6.1.1
Node: 8.11.3OS: linux x64
Angular: 6.1.0... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.1
@angular-devkit/build-angular     0.7.1
@angular-devkit/build-optimizer   0.7.1
@angular-devkit/build-webpack     0.7.1
@angular-devkit/core              0.7.1
@angular-devkit/schematics        0.7.1
@angular/cli                      6.1.1
@ngtools/webpack                  6.1.1
@schematics/angular               0.7.1
@schematics/update                0.7.1
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2

1 个答案:

答案 0 :(得分:1)

您使用别名作为标记-it -is,但在最新的angular6中,与以前不同,-t的别名已更改为--inline-template,{{1}的别名已更改为-s }},

angular-generate-component documentation for reference enter image description here