Skip to content

Instantly share code, notes, and snippets.

@addamh
Created April 26, 2017 17:53
Show Gist options
  • Save addamh/2612ea86f6ccbdb555c952dd00092b7a to your computer and use it in GitHub Desktop.
Save addamh/2612ea86f6ccbdb555c952dd00092b7a to your computer and use it in GitHub Desktop.
computedpropertiesfireoninputs
import Ember from 'ember';
export default Ember.Controller.extend({
computedPropertyOnSearchTerm: Ember.computed('searchTerm', function() {
$('ul').append('<li>i am firing</li>');
return `(( I am the computed property value -- ${this.get('searchTerm')}))`;
})
});
<h3>searchTerm: <br/>
{{searchTerm}}</h3>
<br/>
<h3>computedPropertyOnSearchTerm: <br/>
{{computedPropertyOnSearchTerm}}</h3>
{{input value=searchTerm}}
<br/>
<ul>
</ul>
{
"version": "0.12.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.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment