This file contains 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 } = Ember; | |
export default Ember.Controller.extend({ | |
items: [{ | |
name: 'Foo', | |
isActive: true | |
}, { | |
name: 'Bar', | |
isActive: false |
This file contains 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 } = Ember; | |
export default Ember.Controller.extend({ | |
commentArray: computed('model.comments.[]', function() { | |
return this.get('model.comments').toArray(); | |
}), | |
favourites: computed.filterBy('model.comments', 'isFavourite'), | |
favouritesHack: computed.filterBy('commentArray', 'isFavourite'), | |
}); |
This file contains 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() { | |
return { | |
name: 'Tomster', | |
outfits: [{ | |
name: 'Austin' | |
}, { | |
name: 'Munich' |
This file contains 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
module LoudFoo | |
def foo | |
super.upcase | |
end | |
end | |
class Foo | |
prepend LoudFoo | |
def foo |
This file contains 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 } = Ember; | |
export default Ember.Controller.extend({ | |
needs: ['application'], | |
appName:'Ember Twiddle', | |
whereAmI: computed.readOnly('controllers.application.currentRouteName') | |
}); |
This file contains 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 } = Ember; | |
export default Ember.Controller.extend({ | |
goldenRatioWidth: computed('height', { | |
get(key) { | |
return this.get('height') * 1.618; | |
}, | |
set(_, value) { | |
this.set('height', value / 1.618); |
This file contains 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, typeOf } = Ember; | |
export default Ember.Component.extend({ | |
value: computed({ | |
set(param, value) { | |
switch(typeOf(value)) { | |
case "string": | |
this._value = value === 'foo' ? 'bar' : value; | |
break; |
This file contains 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 } = Ember; | |
export default Ember.Component.extend({ | |
theValue: computed({ | |
get() { | |
return this._theValue; | |
}, | |
set(key, newValue) { |
This file contains 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 DS from 'ember-data'; | |
const { Model, attr } = DS; | |
export default Model.extend({ | |
name: attr('string'), | |
age: attr('string') | |
}); |
This file contains 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 'minutebase/config/environment'; | |
export default Ember.Component.extend({ | |
classNames: "google-static-map", | |
tagName: "img", | |
attributeBindings: ["src"], | |
width: Ember.computed("viewport.width", { | |
get() { |