Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to-elsewhere is not working from engine when from-elsewhere is in main application #26

Closed
ashvardanyan opened this issue Aug 3, 2018 · 3 comments

Comments

@ashvardanyan
Copy link

Hello

I have {{from-elsewhere name="main"}} in the main application application.hbs file and I am trying to do
{{to-elsewhere named="main" .... }} from route based engines template file and nothing is happening. Maybe I am doing something wrong

Thanks

@ef4
Copy link
Owner

ef4 commented Aug 3, 2018

I think this is engines doing what they're designed to do. You can probably configure your app to share the "ember-elsewhere" service with the engine and then they will interoperate.

@toovy
Copy link

toovy commented Oct 23, 2018

@ashvardanyan I tried the same and it basically works (latest ember and engine versions). As @ef4 said the only "tricky" thing you need to do is to share the service, for reference I've added a source code example:

// app/app.js
const App = Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver,
  engines: {
    yourEngineName: {
      dependencies: {
        services: [
          'ember-elsewhere'
        ]
      }
    }
  }
});
<!-- app/application.hbs -->
{{from-elsewhere name="toolbar"}}
// your-engine-name/addon/engine.js
const Eng = Engine.extend({
  modulePrefix,
  Resolver,
  dependencies: {
    services: ['ember-elsewhere']
  },
});
<!-- your-engine-name/addon/application.hbs -->
{{to-elsewhere named="toolbar" send=(component "some-toolbar-button")}}

Tested with an in-repo-engine.

@ef4
Copy link
Owner

ef4 commented Oct 26, 2018

Thanks @toovy I added a link to your helpful example comment in the README.

@ef4 ef4 closed this as completed Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants