2016-07-11 62 views

回答

0

我能够在setupController挂钩中的application.js路线中设置它。

export default Ember.Route.extend({ 
    setupController(){ 
     this.notifications.setDefaultAutoClear(true); 
     this.notifications.setDefaultClearNotification(1200); 
    } 
}); 

我没有什么明确的是,它需要去钩的内部路由/组件/控制器/服务,也是setDefaultAutoClear(true)需要的内部先调用。这不是在文档中,而是暗示如果您要使用它的默认值,则使用它。

1

这个插件使用了注入everything一个service

['controller', 'component', 'route', 'router', 'service'].forEach(injectionTarget => { 
    application.inject(injectionTarget, 'notifications', 'notification-messages:service'); 
}); 

所以this.notifications只是总是相同的单。

相关问题