Skip to content

Instantly share code, notes, and snippets.

@v3ss0n
Last active October 26, 2016 16:04
Show Gist options
  • Save v3ss0n/fb42706e59b7427aa65cc02ac34eea55 to your computer and use it in GitHub Desktop.
Save v3ss0n/fb42706e59b7427aa65cc02ac34eea55 to your computer and use it in GitHub Desktop.
checkbox_filter
import Ember from 'ember';
export default Ember.Controller.extend({
statusFilterObjs:Ember.A( [{
status: "New",
checked: true
}, {
status: "Answering",
checked: true
}, {
status: "Closed",
checked: true
}]),
statusFilters: Ember.computed('statusFilterObjs.[]', function() {
return this.get('statusFilterObjs')
}),
});
import Ember from 'ember';
export default Ember.Route.extend({
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{#each statusFilterObjs as |s|}}
{{s.checked}}
{{/each}}
{{#each statusFilters as |s|}}
{{s.status}}
{{/each}}
<br>
<br>
{{#each statusFilterObjs as |s|}}
{{input type="checkbox" name=s.status checked=s.checked }}
{{/each}}
{
"version": "0.10.6",
"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.9.0",
"ember-data": "2.9.0",
"ember-template-compiler": "2.9.0",
"ember-testing": "2.9.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment