Components: Navigation Schematic Error

Created on 22 May 2018  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Expect the component to load

What is the current behavior?

Currently getting an error template parse errors:
Uncaught Error: Template parse errors: Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 (" class="sidenav" fixedInViewport="true" [ERROR ->][attr.role]="isHandset$ | async ? 'dialog' : 'navigation'" [mode]="isHandset$ | async ? 'over' : "): ng:///AppModule/LamboNavigationComponent.html@5:4 Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 (" fixedInViewport="true" [attr.role]="isHandset$ | async ? 'dialog' : 'navigation'" [ERROR ->][mode]="isHandset$ | async ? 'over' : 'side'" [opened]="!(isHandset$ | async)"> <mat-toolbar "): ng:///AppModule/LamboNavigationComponent.html@6:4 Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 (" fixedInViewport="true" [attr.role]="isHandset$ | async ? 'dialog' : 'navigation'" [ERROR ->][mode]="isHandset$ | async ? 'over' : 'side'" [opened]="!(isHandset$ | async)"> <mat-toolbar "): ng:///AppModule/LamboNavigationComponent.html@6:4 Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("isHandset$ | async ? 'dialog' : 'navigation'" [mode]="isHandset$ | async ? 'over' : 'side'" [ERROR ->][opened]="!(isHandset$ | async)"> <mat-toolbar color="primary">Menu</mat-toolbar> <mat-nav-li"): ng:///AppModule/LamboNavigationComponent.html@7:4 Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 ("isHandset$ | async ? 'dialog' : 'navigation'" [mode]="isHandset$ | async ? 'over' : 'side'" [ERROR ->][opened]="!(isHandset$ | async)"> <mat-toolbar color="primary">Menu</mat-toolbar> <mat-nav-li"): ng:///AppModule/LamboNavigationComponent.html@7:4 Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'over' : 'side'] in ng:///AppModule/LamboNavigationComponent.html@6:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComponent.html@1:2, Directive MatSidenav Parser Error: Unexpected token '?' at column 20 in [isHandset$ | async ? 'dialog' : 'navigation'] in ng:///AppModule/LamboNavigationComponent.html@5:4 ("<mat-sidenav-container class="sidenav-container"> [ERROR ->]<mat-sidenav #drawer class="sidenav" "): ng:///AppModule/LamboNavigationComcompiler.js:215) at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14702) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:22709) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:22696) at compiler.js:22639 at Set.forEach (<anonymous>) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:22639) at compiler.js:22549 at Object.then (compiler.js:206) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:22548)

What are the steps to reproduce?

New Angular CLI Project:
"@angular/animations": "^6.0.2",
"@angular/cdk": "^6.1.0",
"@angular/common": "^6.0.2",
"@angular/compiler": "^6.0.2",
"@angular/core": "^6.0.2",
"@angular/forms": "^6.0.2",
"@angular/http": "^6.0.2",
"@angular/material": "^6.1.0",
"@angular/platform-browser": "^6.0.2",
"@angular/platform-browser-dynamic": "^6.0.2",
"@angular/router": "^6.0.2",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"

"@angular/compiler-cli": "^6.0.2",
"@angular-devkit/build-angular": "~0.6.3",
"typescript": "~2.7.2",
"@angular/cli": "~6.0.3",
"@angular/language-service": "^6.0.2",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"

Started a new project from scratch. Wanted a quick start with schematics and it fails with template parse errors.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

Most helpful comment

Change isHandset$ | async ? to (isHandset$ | async) ? fixed temporary that error syntax

All 4 comments

Change isHandset$ | async ? to (isHandset$ | async) ? fixed temporary that error syntax

Looks like this PR broke the schematic: https://github.com/angular/material2/pull/11310/files

That fixed it. Thanks.

Just FYI for anyone else, I had to change it in both the attr.role and mode.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitaly-t picture vitaly-t  路  3Comments

3mp3ri0r picture 3mp3ri0r  路  3Comments

xtianus79 picture xtianus79  路  3Comments

dzrust picture dzrust  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments