Last active
September 8, 2017 07:57
-
-
Save smile921/41f9e47735dd5951793808bf9309f754 to your computer and use it in GitHub Desktop.
mixin demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import * as DemoMixin from './../mixins/DemoMixin'; | |
export default Ember.Component.extend(DemoMixin ,{ | |
init(){ | |
this._super(...arguments); | |
console.log('demo component inited'); | |
}, | |
hello(){ | |
console.log('overrided in demo component') | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Mixin.create({ | |
init(){ | |
this._super(...arguments); | |
console.log('demo mixin inited'); | |
}, | |
didInsertElement(){ | |
console.log('demo mixin did insert element'); | |
}, | |
hello(){ | |
//to be override | |
console.log('demo mixin hello'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('demo-route'); | |
}); | |
export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model(){ | |
let lineChart = [ | |
{ | |
name: 'John', | |
values: [7512, 8093, 14731, 10082], | |
color: 'red' | |
}, | |
{ | |
name: 'Anne', | |
values: [9923, 9789, 8309, 10810], | |
color: 'green' | |
}, | |
{ | |
name: 'Robert', | |
values: [6039, 7093, 4020, 9501], | |
color: 'blue' | |
} | |
]; | |
return { | |
lineChart: lineChart, | |
id: 1 | |
}; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment