3

I read about the new ng generate @angular/material:material-nav feature in this recent Angular blog entry .

Unfortunately, when running the following CLI commands in a brand new project, I get an error message (see below).

ng add @angular/material
ng generate @angular/material:material-nav

Error message:

Schematic input does not validate against the Schema: {"dryRun":false,"inlineStyle":false,"inlineTemplate":false,"changeDetection":"Default","styleext":"css","spec":true,"flat":false,"skipImport":false,"export":false}
Errors:

Data path "" should have required property 'name'.

This kind of sucks. I tried adding a name like this

ng generate @angular/material:material-nav home

But it still produces the same error. Please advice.

Angular CLI: 6.0.0 Node: 8.11.1 OS: darwin x64 Angular: 6.0.0

4

1 回答 1

10

该错误意味着属性名称是必需的,所以命令应该是这样的:

ng generate @angular/material:material-nav --name <component-name>

例如:

ng generate @angular/material:material-nav --name home
于 2018-05-04T02:45:42.140 回答