Skip to content

Instantly share code, notes, and snippets.

@etuchscherer
Last active June 9, 2016 00:02
Show Gist options
  • Save etuchscherer/776af780be85995986ee2307784cf01d to your computer and use it in GitHub Desktop.
Save etuchscherer/776af780be85995986ee2307784cf01d to your computer and use it in GitHub Desktop.
equal
import Ember from 'ember';
export default Ember.Controller.extend({
val1: 1,
val2: 2,
comparison: Ember.computed.equal('val1', 'val2'),
actions: {
click() {
this.set('val1', 2);
}
}
});
<p>When the button is clicked, equal should observe the change, right ??</p>
<button {{action 'click' on='click'}}>increment val 1</button>
{{#if comparison}}
Equal observed val1 as expected...
{{else}}
nothing happened yet...
{{/if}}
<br>
<br>
Value 1 :: {{val1}}
<br>
Value 2 :: {{val2}}
{
"version": "0.8.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.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment