Skip to content

Instantly share code, notes, and snippets.

@e00dan
Last active November 19, 2015 11:41
Show Gist options
  • Save e00dan/8d22a0c79147a3783824 to your computer and use it in GitHub Desktop.
Save e00dan/8d22a0c79147a3783824 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
index: Ember.inject.controller('index'),
indexIsClicked: Ember.computed.alias("index.isClicked"),
isIndexClicked: Ember.observer('index.isClicked', function() {
alert("its changed to " + this.get("indexIsClicked"));
})
});
{{outlet}}
<br>
Is index clicked: <b>{{indexIsClicked}}</b>
<br>
import Ember from 'ember';
export default Ember.Controller.extend({
isClicked: false,
actions: {
clicked() {
console.log("change the isClicked value") ;
this.toggleProperty('isClicked');
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
<div {{action "clicked"}}>Click me</div>
{
"version": "0.4.16",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment