Skip to content

Instantly share code, notes, and snippets.

@jelhan
jelhan / components.component-using-helper.js
Last active April 14, 2016 00:00
stackoverflow 36602056
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'p'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
someActionName() {
this.set('recordFromStore',
JSON.stringify(this.store.peekRecord('shape', 1)));
}
},
import Ember from 'ember';
export default Ember.Component.extend({
_willDestroyElement: Ember.on('willDestroyElement', function() {
Ember.assert('parentView undefined on willDestroyElement event', !Ember.isEmpty(this.get('parentView')));
})
});
import Ember from 'ember';
export default Ember.Component.extend({
classNameBindings: ['clicked'],
tagName: 'button',
click() {
this.set('clicked', true);
}
});
@jelhan
jelhan / components.my-component.js
Created July 22, 2016 15:59
ember-bootstrap/116
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this.set('useIconsIsDefault',
!this.attrs.hasOwnProperty('useIcons')
);
this._super(...arguments);
},
@jelhan
jelhan / controllers.application.js
Created August 15, 2016 18:22
ember-bootstrap-datepicker with momentjs
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
date: computed('model', {
get() {
return this.get('moment').toDate();
},
@jelhan
jelhan / controllers.application.js
Created August 20, 2016 19:47
ember-cli-flash in acceptance test
import Ember from 'ember';
const { inject } = Ember;
export default Ember.Controller.extend({
actions: {
addFlashMessage() {
this.get('flashMessages').info('just a test');
}
},
import Ember from 'ember';
import groupBy from 'ember-group-by';
const { computed } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
meetings: computed.readOnly('model'),
meetingsPerDay: groupBy('meetings', 'day')
@jelhan
jelhan / controllers.application.js
Created November 1, 2016 12:13
aomran/ember-cli-chart #50
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Controller.extend({
data: computed(function(){
var labels = ["January", "February", "March", "April", "May", "June"];
return {
labels: labels,
@jelhan
jelhan / adapters.application.js
Last active December 23, 2016 20:04 — forked from samselikoff/mirage.config.js
Mirage dev boilerplate
import DS from 'ember-data';
const { RESTAdapter } = DS;
export default RESTAdapter.extend({});