Skip to content

Instantly share code, notes, and snippets.

@brandonhilkert
Last active August 29, 2015 14:20
Show Gist options
  • Save brandonhilkert/f845ee9c1779bdf2332f to your computer and use it in GitHub Desktop.
Save brandonhilkert/f845ee9c1779bdf2332f to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['filter', 'sort'],
filter: {},
sort: '-id'
});
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
queryParams: {
filter: { refreshModel: true },
sort: { refreshModel: true }
},
model: function(params) {
return this.store.find('account', params);
},
});
<h3>Accounts</h3>
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="id-col">{{input type="text" placeholder="ID" value=filter.id classNames="form-control"}}</th>
</tr>
</thead>
<tbody>
{{#each account in model}}
<tr>
<td class="text-center">{{account.id}}</td>
{{/each}}
</tbody>
</table>
When the query param is an object ('filter') it doesn't seem to trigger changes to the model. It worked before I involved the filter object and the controller attribute was just "id". Is there something about an object that it won't observe?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment