Hi, i write an addon und generate routes/templates inside this addon. But the routes does not accessable. How can i inject these addon-routes into router.js or respectively make this routes accessable? thx
You can define routes in an addon and they will be merged into the app’s namespace (if they are properly re-exported) however they aren’t added to the route map unless you either:
- add them to the app’s route map as usual
- do it in the addon in an instance-initializer (pretty sure this works) so any app that uses the addon will automatically add the addon routes to the route map
Alternatively you could use a routable engine, which is really kind of the answer to “an addon that has routes”
thank you for your help. All this ways i have done in the past and it always worked, but only not in this case.
Now I just had an epiphany. I have do a great mistake. In use of all this ways i become the message “too many recursions” from browser console. The great mistake is that i use the same name for main project an for the used addon. In this case i build a special addon for a customer project. I gave the addon a new name and it works fine now.
Thank you for your fast help
Awesome glad you got it working!