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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -