ember.js - Ember 1.12 Inject Route into Service -


i'm trying create service handle modal dialogs in ember 1.12 ember-cli. maybe service isn't best way approach this, want access anywhere in app, , able dynamically insert content popup, seemed right way go.

here service:

import ember 'ember';  export default ember.service.extend({     route: ember.inject.service('route'),     open: function(content){         console.log('open popup', content);          this.get('route').render('popup-box', { //popup-box component             into: 'application',             outlet: 'popup'         });     },      close: function(){         //todo     } }); 

when call open method, error:

uncaught error: attempting inject unknown injection: service:route

i'm not sure i'm missing. suggestions?

you should check out ember-wormhole, https://github.com/yapplabs/ember-wormhole. let target section of template anchor somewhere else in dom. it's perfect modals!

additional info:

as @runspired pointed out, can't inject router have it.

if did want inject router, ember.inject.service('-routing') or via application.inject('<mytarget>', 'router', 'router:main'); initializer.

however, not have access render method , considered smell.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -