I have a lot of controllers using difference services,where I should extend one mixin. In mixin, based on the controller's call I should inject difference service. Is it really do ? If yes, I open to any suggestions. My controller look like this:
import FilterController from 'core/addon/filter/filter-controller';
import defaultMixin from 'default-mixin';
export default FilterController.extend(defaultMixin,{
filter: Ember.inject.service(Pathes.inject.service.leaseFilter),
})
Mixin:
import Ember from 'ember';
import Views from '../const/views';
import ViewsService from '../static-services/views';
const {
computed,
} = Ember;
export default Ember.Mixin.create({
##THIS VIEW SERVICE I SHOULD INJECT BASED ON CONTROLLER ##VIEW.INJECT.SERVICE.[LEASE,LEASE1,LEASE2,LEASE3]
viewService: Ember.inject.service(Views.inject.service.Lease),
defaultViewType: computed(
'viewService.filteredViewsList',
function () {
const viewList = this.get('viewService.filteredViewsList');
return ViewsService.getDefaultViewFromList(viewList);
}
),
});
Aucun commentaire:
Enregistrer un commentaire