Skip to content

Instantly share code, notes, and snippets.

@mbratukha
Last active October 28, 2015 10:29
Show Gist options
  • Save mbratukha/90798b4952deb4a83de1 to your computer and use it in GitHub Desktop.
Save mbratukha/90798b4952deb4a83de1 to your computer and use it in GitHub Desktop.
toggleProperty bug?
import Ember from 'ember';
export default Ember.Component.extend({
prop1: false,
hello: "Default text of comp-1",
_changeHello: function() {
this.set('hello', 'Text set by comp-1');
}.on("init"),
actions: {
customAction1() {
this.toggleProperty('prop1');
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
data: [],
_doSomeImportentStuff: function() {
var data = [
{name: 'Text set by comp-2', bool: false},
{name: 'Text set by comp-2', bool: true}
];
this.set('data', data);
}.on("init")
});
<button {{action 'customAction1'}}>{{hello}}</button>
{{#each data as |d|}}
{{comp-1 hello=d.name prop1=d.bool}}
{{/each}}
{
"version": "0.4.9",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.0.1/ember.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.0.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.0.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment