Невозможно добавить имя `class` к тегу`body` с помощью `route` в движке ember
Я требую добавить имя класса для каждой страницы, чтобы написать специфичные для страницы свойства CSS. для этого я пробую следующее: но ничего не работает. Я тоже не получаю никаких ошибок..
кто-нибудь, пожалуйста, помогите мне здесь?
мой код:
import buildRoutes from 'ember-engines/routes';
import Ember from 'ember';
export default buildRoutes(function () {
this.route('dac', {path: '/dac'}, function () {
this.route('icp');
this.route('dac-product-selection');
});
this.route('cs2i', {path: '/cs2i'}, function () {
this.route('cs2i-product-selection');
this.route('balance', {path: '/balance'}, function () {
this.route('balance-details');
this.route('balance-edit');
this.route('balance-review');
this.route('balance-confirmation');
});
this.route('purchase', {path: '/purchase'}, function () {
this.route('purchase-details');
this.route('purchase-edit');
this.route('purchase-review');
this.route('purchase-confirmation');
});
});
//adding class name to body but not works!!
Ember.Route.reopen({
activate: function() {
var cssClass = this.toCssClass();
if (cssClass != 'application') {
Ember.$('body').addClass(cssClass);
}
},
deactivate: function() {
Ember.$('body').removeClass(this.toCssClass());
},
toCssClass: function() {
return this.routeName.replace(/\./g, '-').dasherize();
}
});
});