I would like to have common routes defined in an addon, which can be shared by our multiple projects. Trying to follow an approach with mixins, so far without any luck.
In the addon/mixins/common-routes.js is defined mixin:
export default Ember.Mixin.create({
coreMap: function(self) {
self.resource('events', function() {
self.route('future');
self.route('add');
});
}
});
And then use this in project router.js:
import Ember from 'ember';
import config from './config/environment';
import CoreRoutes from 'core/mixins/core-router';
var Router = Ember.Router.extend(CoreRoutes, {
location: config.locationType
});
Router.map(function() {
this.coreMap(this);
//custom routes
this.resource('events', function() {
this.route('edit');
this.route('add');
});
});
export default Router;
The result is: TypeError: this.coreMap is not a function (Importing of the mixin is correct, I can debug the CoreRoutes object)
Any ideas, where Iām doing wrong assumtions?