ember.js - Injecting application controller into all other controllers -
i'm hoping use application controller displaying dynamic modal components. convenient if inject application controller other controllers, rather explicitly injecting in each controller file it's needed.
initialize = (app) -> app.inject 'controller', 'appcontroller', 'controller:application' app.inject 'component' , 'appcontroller', 'controller:application' injectapplicationcontroller = name: 'inject-application-controller' initialize: initialize `export {initialize}` `export default injectapplicationcontroller`
please forgive coffeescript; gives me error, controller cannot injected other controllers. there workaround?
i recommend use service hold state, can reopen ember.controller
in initializer:
ember.controller.reopen({ appcontroller: ember.controller.inject('application') });
Comments
Post a Comment