Skip to content

Instantly share code, notes, and snippets.

@jlami
Last active February 16, 2017 11:09
Show Gist options
  • Save jlami/e2ae34408684b970278bd5c05df1c18c to your computer and use it in GitHub Desktop.
Save jlami/e2ae34408684b970278bd5c05df1c18c to your computer and use it in GitHub Desktop.
Ignored action on re-render?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
//query: '',
clicked: false,
arr: Ember.computed('query', function() {
console.log('arr', this.get('query'));
let a = [];
if (this.get('query') !== undefined) {
a.push('test2');
} else {
a.push('test');
}
return Ember.A(a);
}),
queryParams: ["clicked", "query"],
actions: {
test() {
this.set('clicked', true);
},
},
});
<h1>Welcome to {{appName}}</h1>
Click in textbox first, then click link
<br>
Query: '{{query}}'<br>
Clicked: {{clicked}}<br>
<br>
{{my-component arr=arr query=query clicked=clicked}}
<br>
<br>
{{input value=query}}
{{!--autofocus="autofocus"--}}
{{#each arr as |t|}}
<a href="#" {{action (action (mut clicked) true)}}>Click me</a>
{{/each}}
{
"version": "0.11.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js",
"ember": "2.11.0",
"ember-data": "2.11.1",
"ember-template-compiler": "2.11.0",
"ember-testing": "2.10.2"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment