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', | |
init() { | |
this._super(...arguments); | |
const posts = []; | |
this.set('posts', posts); | |
posts.pushObject(this.store.createRecord('post', { |
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.Component.extend({ | |
classes: 'green', | |
classNames: 'red', | |
didInsertElement() { | |
this._super(...arguments); | |
const $this = Ember.$('#' + this.get('elementId')); |
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.Component.extend({ | |
actions: { | |
checkAttrs() { | |
alert(this.attrs.foo); | |
alert(this.attrs.bar); | |
alert(this.attrs.baz); | |
} | |
} |
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.Component.extend({ | |
}); |
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.Component.extend({ | |
green() { | |
this.$().css('background-color', 'green'); | |
}, | |
red() { | |
this.$().css('background-color', 'red'); | |
}, |
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 FooMixin from 'app/components/mixins/foo-mixin'; | |
export default Ember.Component.extend( | |
FooMixin, | |
{ | |
}); |
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'; | |
const { computed, Component } = Ember; | |
export default Component.extend({ | |
firstItem: computed.alias('someList.firstObject') | |
}); |
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 { attrDidInitOrUpdate, getAttrValue } from 'app/utils/attr-helper'; | |
const { run } = Ember; | |
export default Ember.Component.extend({ | |
didReceiveAttrs({ oldAttrs, newAttrs }) { | |
this._super(...arguments); | |
const fooChanged = attrDidInitOrUpdate('foo', oldAttrs, newAttrs); |
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.Component.extend({ | |
}); |
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'; | |
const { assign, computed, get, merge } = Ember; | |
export default Ember.Component.extend({ | |
cat: { | |
meow: 'purr', | |
scratch: 'always', | |
}, | |