Pendem Pradeep

Pendem Pradeep

  • 1.9k
  • 11
  • 569

Routing in Angular 2

Jul 3 2019 9:01 AM
I have tried do work on roouting , but when i have started working the project , it is not creating the routing module by default. If i try creating the routing module it is throwing errors
 
zone.js:522 Unhandled Promise rejection: Template parse errors:
'app-home' is not a known element:
1. If 'app-home' is an Angular component, then verify that it is part of this module.
2. If 'app-home' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
<router-outlet></router-outlet>
[ERROR ->]<app-home></app-home>
"): AppComponent@40:0 ; Zone: <root> ; Task: Promise.then ; Value: SyntaxError {__zone_symbol__error: Error: Template parse errors:
'app-home' is not a known element:
1. If 'app-home' is an Angular com…, …} Error: Template parse errors:
'app-home' is not a known element:
1. If 'app-home' is an Angular component, then verify that it is part of this module.
2. If 'app-home' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
<router-outlet></router-outlet>
[ERROR ->]<app-home></app-home>
"): AppComponent@40:0
at SyntaxError.ZoneAwareError (http://localhost:4200/polyfills.bundle.js:7744:33)
at SyntaxError.BaseError [as constructor] (http://localhost:4200/vendor.bundle.js:71385:16)
at new SyntaxError (http://localhost:4200/vendor.bundle.js:6043:16)
at TemplateParser.parse (http://localhost:4200/vendor.bundle.js:20015:19)
at JitCompiler._compileTemplate (http://localhost:4200/vendor.bundle.js:52256:68)
at http://localhost:4200/vendor.bundle.js:52139:62
at Set.forEach (<anonymous>)
at JitCompiler._compileComponents (http://localhost:4200/vendor.bundle.js:52139:19)
at createResult (http://localhost:4200/vendor.bundle.js:52021:19)
at ZoneDelegate.invoke (http://localhost:4200/polyfills.bundle.js:7086:26)
at Zone.run (http://localhost:4200/polyfills.bundle.js:6878:43)
at http://localhost:4200/polyfills.bundle.js:7465:57
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:7119:31)
at Zone.runTask (http://localhost:4200/polyfills.bundle.js:6918:47)
at drainMicroTaskQueue (http://localhost:4200/polyfills.bundle.js:7298:35)
consoleError @ zone.js:522
handleUnhandledRejection @ zone.js:527
_loop_1 @ zone.js:562
drainMicroTaskQueue @ zone.js:566
Promise.then (async)
scheduleQueueDrain @ zone.js:505
scheduleMicroTask @ zone.js:513
ZoneDelegate.scheduleTask @ zone.js:356
Zone.scheduleTask @ zone.js:196
Zone.scheduleMicroTask @ zone.js:207
scheduleResolveOrReject @ zone.js:711
ZoneAwarePromise.then @ zone.js:800
ZoneAwarePromise.all @ zone.js:780
JitCompiler._loadModules @ compiler.js:173
JitCompiler._compileModuleAndComponents @ compiler.js:125
JitCompiler.compileModuleAsync @ compiler.js:91
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
425 @ main.ts:10
__webpack_require__ @ bootstrap 31baee58f8a799ebf855:52
796 @ main.bundle.js:467
__webpack_require__ @ bootstrap 31baee58f8a799ebf855:52
webpackJsonpCallback @ bootstrap 31baee58f8a799ebf855:23
(anonymous) @ main.bundle.js:1
zone.js:524 ZoneAwareError {__zone_symbol__error: Error: Uncaught (in promise): Error: Template parse errors:
'app-home' is not a known element:
1. I…, …}

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)