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 { Controller, computed } = Ember; | |
export default Controller.extend({ | |
items: computed(function() { | |
return ['Item1', 'Item2', 'Item3']; | |
}) | |
}); |
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', | |
actions: { | |
handler() { | |
window.alert('You clicked me!'); | |
} | |
} | |
}); |
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({ | |
sections: [1,2,3,4,5], | |
currentSection: 0, | |
isLastSection: Ember.computed('currentSection', function() { | |
return this.get('currentSection') === this.get('sections.length') - 1; | |
}), | |
sectionClassName: Ember.computed('currentSection', function() { | |
return 'section-' + this.get('currentSection'); |
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 ExampleObject from '../util/example'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
exampleObject:Ember.computed(function() { | |
return ExampleObject.create(); | |
}), | |
myProp: Ember.computed.alias('exampleObject.serviceProp') | |
}); |
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:'input demo', | |
myValue: 'Write', | |
myInitialValue: Ember.computed.defaultTo('myValue') | |
}); |
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({ | |
openBrackets: '{{', | |
closeBrackets: '}}', | |
'crazy-property': 'this' | |
}); |
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({ | |
openBrackets: '{{', | |
closeBrackets: '}}', | |
'crazy-property': 'this' | |
}); |
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 } = Ember; | |
export default Ember.Controller.extend({ | |
goldenRatioWidth: Ember.computed('height', { | |
get(key) { | |
return this.get('height') * 1.618; | |
}, | |
set(key, value) { | |
this.set('height', value / 1.618); |
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, typeOf } = Ember; | |
export default Ember.Component.extend({ | |
value: computed({ | |
set(param,setter,previousValue) { | |
console.log('VALUE: CP setter value: %o. Previous value had been: %o', setter, previousValue); | |
switch(typeOf(setter)) { | |
case "string": | |
// returns a string but can pass back different outcome than what sent in |
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
Verifying that +vitch is my openname (Bitcoin username). https://onename.com/vitch |