Skip to content

Instantly share code, notes, and snippets.

@pixelhandler
Forked from ismyrnow/application.controller.js
Last active June 17, 2016 19:58
Show Gist options
  • Save pixelhandler/0ec50ce44f02e8075c33 to your computer and use it in GitHub Desktop.
Save pixelhandler/0ec50ce44f02e8075c33 to your computer and use it in GitHub Desktop.
Instead of renaming QueryParams use a computed property
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function (transition) {
this.transitionTo('test', {
queryParams: {
sidebar: true,
footer: true
}
});
}
});
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('test');
});
export default Router;
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: [
'sidebar',
{ isFooterVisible: { as: 'footer' } }
],
sidebar: false,
isFooterVisible: false
});
<h2>test/template.hbs</h2>
<p>This twiddle demonstrates an issue where renamed query params cause a problem when passed in a call to "transitionTo".</p>
<p>The application fails to load.</p>
sidebar?: {{#if sidebar}}Yes{{else}}No{{/if}}
<br>
isFooterVisible?: {{#if isFooterVisible}}Yes{{else}}No{{/if}}
{
"version": "0.4.6",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "release",
"ember-template-compiler": "release"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment