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'; | |
const {isEqual} = Ember; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
propertyName:'isSelected', | |
actions:{ | |
change(){ | |
this.toggleProperty('model.'+this.get('propertyName')); | |
}, |
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', | |
inputData:{'1000': "data from first input", '1001': "data from second input",'1002': "data from third input"}, | |
}); |
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'; | |
function makeCP(keys, cb) { | |
keys = keys.map(key => `someObj.${key}`); | |
const args = [...keys, cb]; | |
return Ember.computed(...args); | |
} | |
const someObj = { |
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({ | |
tagName: 'input', | |
attributeBindings: [ 'type', 'value', 'placeholder', 'data-stripe', 'name' ], | |
type: 'text', | |
_sanitizedValue: undefined, | |
input() { this._handleChangeEvent(); }, | |
change() { this._handleChangeEvent(); }, |
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({ | |
didReceiveAttrs(){ | |
this._super(...arguments); | |
console.log('didReceiveAttr'); | |
}, | |
didUpdateAttrs(options){ | |
this._super(...arguments); | |
if(options.oldAttrs.isSidebarOpen.value !== options.newAttrs.isSidebarOpen) { |
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({ | |
didReceiveAttrs(options){ | |
this._super(...arguments); | |
//this will run both initial render and rerender. | |
//For initial rendering alone options.oldAttrs will not be available | |
}, | |
didUpdateAttrs(options){ | |
this._super(...arguments); |
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({ | |
tempValue: '', | |
actions: { | |
changeValue: function(event) { | |
event.preventDefault(); | |
let value = event.target.value; | |
this.set('tempValue', value); |
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 {get,set} = Ember; | |
export default Ember.Component.extend({ | |
val:'', | |
actions:{ | |
update(newVal){ | |
let oldVal = get(this, 'val'); | |
console.log('newVal-',newVal+' oldVal-',oldVal); | |
if(!newVal.includes('C')) { | |
set(this, 'val', newVal); |
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 DS from 'ember-data'; | |
export default DS.RESTAdapter.extend({ | |
}); |