ember.jsember-engines

How to define a route for ember-engine


As the title said, I can't figure out how to define a route for an Ember.js Engines in an Ember.js Application.
I tried to follow the tutorial, but I don't understand how the route work.
An add-on made with ember-engines cannot be placed in the Application, so where should he be placed? In another repository, I suppose, but then how to define its route in the app/router.js.

I will recap everything I have done until now:

  1. Created the addon :
    ember addon myAddon
  2. Installed the addon ember-engines in both repositories (application and addon):
    ember install ember-engines

Right now, I have two repositories, but the addon one is quite empty. So we will add in this repository all the things that are needed for the addon to "work."

  1. Added my environment variable, my index.js, my addon/route.js and my engine.js.

  2. I putted <h3>Hello World!</h3> in my addon/templates/application.hbs.

And here comes the problematic part. How do I call the addon in my application? I mean in the router.js of my application?

  1. I tried:
    this.mount('myAddon'); this.mount('myAddon', { path: '../../addon/myAddon}); which is the path to my addon, but I can of understand this is not a good way to call it.

So if any of you can help me out, that will be very appreciated.


Solution

  • I solved it. The problem was not in the addon itself, but in the package.json of my app. I just added in the dependencies "myAddon": "path/to/my/addon".