angular - Angular2 - The selector "my-app" did not match any elements (only on first load) -
does know why error when page loads first time in angular2 app? clears away , doesn't come navigate through app. if hit ctrl+f5 tends come (though not every single time!). routing app looks this:
appcomponent.ts logincomponent.ts dashboardcomponent(parent route own child routes) maindashboardcomponent employeescomponent
the top level index.html file has <my-app></my-app>
tag in error complains periodically i'm confused how wouldn't see tag on page!
error details:
exception: selector "my-app" did not match elementsbrowserdomadapter.logerror @ angular2.dev.js:22823browserdomadapter.loggroup @ angular2.dev.js:22834exceptionhandler.call @ angular2.dev.js:1163(anonymous function) @ angular2.dev.js:12481ngzone._notifyonerror @ angular2.dev.js:13405collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13309run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$$internal$$trycatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokecallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:13360run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305 angular2.dev.js:22823 stacktrace:browserdomadapter.logerror @ angular2.dev.js:22823exceptionhandler.call @ angular2.dev.js:1165(anonymous function) @ angular2.dev.js:12481ngzone._notifyonerror @ angular2.dev.js:13405collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13309run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$$internal$$trycatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokecallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:13360run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305 angular2.dev.js:22823 error: selector "my-app" did not match elements @ new baseexception (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:7104:21) @ domrenderer.selectrootelement (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:13724:15) @ hostviewfactory.viewfactory_hostappcomponent0 [as viewfactory] (viewfactory_hostappcomponent:72:18) @ appviewmanager_.createroothostview (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9226:34) @ http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12246:46 @ zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:138:17) @ zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:13328:32) @ zoneboundfn (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:111:19) @ lib$es6$promise$$internal$$trycatch (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1511:16) @ lib$es6$promise$$internal$$invokecallback (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1523:17)
-----async gap----- error @ _getstacktracewithuncaughterror (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2195:26) @ zone.fork (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2253:40) @ zone.bind (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:109:48) @ bindarguments (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:980:29) @ lib$es6$promise$promise$$promise.obj.(anonymous function) [as then] (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1000:37) @ dynamiccomponentloader_.loadasroot (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12245:49) @ di_1.provide.usefactory (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12343:39) @ injector._instantiate (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:11354:19) @ injector._instantiateprovider (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:11287:21) @ injector._new (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:11277:19)
-----async gap----- error @ _getstacktracewithuncaughterror (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2195:26) @ zone.fork (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2253:40) @ ngzone._createinnerzone (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:13316:39) @ new ngzone (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:13182:32) @ createngzone (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12365:12) @ platformref_.application (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12440:31) @ object.bootstrap (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:24543:64) @ execute (http://localhost:3000/app/main.js:15:23) @ ensureevaluated (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3202:26) @ object.execute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3323:13)browserdomadapter.logerror @ angular2.dev.js:22823exceptionhandler.call @ angular2.dev.js:1166(anonymous function) @ angular2.dev.js:12481ngzone._notifyonerror @ angular2.dev.js:13405collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13309run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$$internal$$trycatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokecallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:13360run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:13328zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
probably should add <script>
tag in index.html file after </body>
tag.
your script should run after dom ready.
update:
<body> <my-app>loading...</my-app> <script> //your scripts </script> </body>
Comments
Post a Comment