我试图将Woof警报整合到ember中,但没有成功。
以下是我在app.js文件中的代码:
window.App = Em.Application.create();
Ember.Application.initializer({
name: "registerwoofmessages",
initialize: function (container, application) {
application.register('woof:main', Ember.woof);
}
});
Ember.Woof = Ember.ArrayProxy.extend({
content: Ember.A(),
timeout: 5000,
pushObject: function (object) {
object.typeClass = 'alert-' + object.type;
this._super(object);
},
danger: function (message) {
this.pushObject({
type: 'danger',
message: message
});
},
warning: function (message) {
this.pushObject({
type: 'warning',
message: message
});
},
info: function (message) {
this.pushObject({
type: 'info',
message: message
});
},
success: function (message) {
this.pushObject({
type: 'success',
message: message
});
}
});
Ember.Application.initializer({
name: "injectWoofMessages",
initialize: function (container, application) {
application.inject('controller', 'woof', 'woof:main');
application.inject('component', 'woof', 'woof:main');
application.inject('route', 'woof', 'woof:main');
}
});
我按照这个例子没有成功:http://jsbin.com/kozolalayuca/1/edit
关于如何解决这个问题的任何想法?