Search code examples
javascriptember.jsquery-stringember-query-params

Query params not persisting in Ember.js


Given the template

<script type="text/x-handlebars">
  {{#link-to 'test' (query-params test=0)}}link{{/link-to}}
</script>

and the script

App = Ember.Application.create();

App.Router.map(function() {
  this.resource('test');
});

App.TestController = Ember.ArrayController.extend({
  queryParams: ['test'],
  test: null
});

The query params are not showing up in the url when I click, shown here http://emberjs.jsbin.com/qawoza/1/edit. What am I doing wrong?


Solution

  • When you're looking at it in editor mode in jsbin, the output is in it's own iframe. If you pop out to live preview you'll see your query params.

    http://emberjs.jsbin.com/qasilu/1