lundi 4 septembre 2017

How to define a route for ember-engine

as it is said in the title, 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 addon made with ember-engines cannot be placed in the Application, so where should he be placed? In an other 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 repository (application and addon):
    ember install ember-engines

Right now, I have two repository, 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 come 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.




Aucun commentaire:

Enregistrer un commentaire