vendredi 3 novembre 2017

Ember app without mounted addon doesn't find addon router

I have a very simply empty Ember application that mounts a very simple empty (1 route only) engine.

Basically in the Main application router.js file I have

Router.map(function() {
  this.mount('my-engine');
});

and in my-engine routes.js file I have

export default buildRoutes(function () {
  this.route('helloworld');
});

If I navigate to

localhost:4200/my-engine

the engine application.hrb is displayed

But if I navigate to

localhost:4200/my-engine/helloworld

then I have a javascript error

TypeError: Cannot read property 'router' of undefined
    at error (router.js:853)
    at Router$1.triggerEvent (router.js:1038)
    at trigger (router.js:111)
    at Transition.trigger (router.js:645)
    at router.js:456
    at tryCatcher (rsvp.js:215)
    at invokeCallback (rsvp.js:393)
    at publish (rsvp.js:379)
    at publishRejection (rsvp.js:314)
    at rsvp.js:14

What am I missing?




Aucun commentaire:

Enregistrer un commentaire