bootstrapping a different module on main module exception

517 views
Skip to first unread message

Silvio Amaral

unread,
Aug 7, 2019, 12:51:17 AM8/7/19
to Angular and AngularJS discussion

Would it be possible to bootstrap a fallback module on the .catch of the platformBrowserDynamic().bootstrapModule(), without running into this warning:"WARNING in Lazy routes discovery is not enabled. Because there is neither an entryModule nor a statically analyzable bootstrap code in the main file."


eg:
platformBrowserDynamic().bootstrapModule(ModuleX).catch(()=>{
return platformBrowserDynamic().bootstrapModule(ModuleY);
})


I can make the app work , however when compiling I get the error on this thread and the dynamic module resolution won't work (from experience in another app, not this example )

Documentation is unhelpful and still trying to work my way on source code, so Im reaching out for help. Any ideas are welcome


Btw, old angular had a really nice way of handling this... 

Sander Elias

unread,
Aug 14, 2019, 4:48:26 AM8/14/19
to Angular and AngularJS discussion
Hi Silvio


Regards
Sander

Silvio Amaral

unread,
Aug 19, 2019, 9:40:48 PM8/19/19
to Angular and AngularJS discussion
So, I'm understanding that this is only available to use when I use AOT compilation. In that case, would it work with dynamic module loading? Unfortunately my site is way too heavy and needs to be served dynamically.

thanks for your reply, anyway

Sander Elias

unread,
Aug 21, 2019, 12:57:43 AM8/21/19
to Angular and AngularJS discussion
Yes, that would work with dynamic loading. 
It will become easier once the modules become optional (post 9). 

Regards
Sander

Silvio do Amaral e Silva

unread,
Aug 25, 2019, 4:59:32 PM8/25/19
to ang...@googlegroups.com
In the end I didn't have any choice but to provide a empty default configuration to my site when the real REST config call failed, redirecting the site to a 500 page and disabling routing.

Thanks for your help,
Silvio Silva


--
You received this message because you are subscribed to a topic in the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/003xkKNAhIY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/e7ebd55b-a341-431d-affc-8a664a087e85%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages