Forked from miguelcobain/components.my-component.js
Last active
July 8, 2016 17:12
-
-
Save shoxter/d7bc618f48a24a89e1bd9411c0d49050 to your computer and use it in GitHub Desktop.
readonly bindings
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({ | |
isTouched: false, | |
_isTouched: false, | |
didUpdateAttrs(params) { | |
if (params.oldAttrs.isTouched !== params.newAttrs.isTouched) { | |
// isTouched did change. time to update internal property | |
this.set('_isTouched', this.get('isTouched')); | |
} | |
}, | |
actions: { | |
toggleIsTouched() { | |
this.toggleProperty('_isTouched'); | |
}, | |
toggleSomeProp() { | |
this.set('value', Math.random()); | |
} | |
} | |
}); |
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', | |
isTouched: true, | |
actions: { | |
toggleIsTouched() { | |
this.set('isTouched', false); | |
} | |
} | |
}); |
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
{ | |
"version": "0.10.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-data": "2.6.1", | |
"ember-template-compiler": "2.5.1" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment