Skip to content

Instantly share code, notes, and snippets.

@gorner
Last active September 17, 2018 20:09
Show Gist options
  • Save gorner/ee98de6c5f0f8342e8fff0388f795289 to your computer and use it in GitHub Desktop.
Save gorner/ee98de6c5f0f8342e8fff0388f795289 to your computer and use it in GitHub Desktop.
core-mixins
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
export default Ember.Mixin.create({
updateModel() {
return (this._super() || '') + '1';
}
});
import CoreFooMixin from 'app/mixins/routes/core-foo';
export default Ember.Mixin.create(CoreFooMixin, {
updateModel() {
return (this._super() || '') + '3';
}
});
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('foo', {path: '/'});
});
export default Router;
import Ember from 'ember';
import CoreFooMixin from 'app/mixins/routes/core-foo';
export default Ember.Route.extend(CoreFooMixin, {
updateModel() {
return (this._super() || '') + '2';
}
});
import CoreFooRoute from 'app/routes/core-foo';
import FooMixin from 'app/mixins/routes/foo';
export default CoreFooRoute.extend(FooMixin, {
updateModel() {
return (this._super() || '') + '4';
},
model() {
return this.updateModel();
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
Foo page!
{{model}}
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment