Skip to content

ng generate @angular/material:material-nav not working #10960

@ghost

Description

Versions

Angular CLI: 6.0.3
Node: 10.1.0
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.3
@angular-devkit/core         0.6.3
@angular-devkit/schematics   0.6.3
@schematics/angular          0.6.3
@schematics/update           0.6.3
rxjs                         6.1.0
typescript                   2.7.2

Repro steps

  • ng new my-new-app --routing
  • ng add @angular/material
  • npm install
  • ng generate @angular/material:material-nav --name=home
  • ng serve

Observed behavior

Fails to compile with the following error:

ERROR in src/app/home/home.component.ts(13,3): error TS2322: Type ‘Observable’ is not assignable to type ‘Observable’. Type ‘boolean’ is not assignable to type ‘BreakpointState’.

The code causing the error is the generated code from step 4 above (home.component.ts)

sHandset$: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
map(result => result.matches)
);

Desired behavior

ng serve should compile and run the generated application locally without the observed error.

Mention any other details that might be useful (optional)

OS Mac OSX High Sierra

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions