Skip to content

Instantly share code, notes, and snippets.

@taras
Forked from ZackMattor/application.controller.js
Last active December 23, 2015 03:51
Show Gist options
  • Save taras/2d49a9d1aa3ddaff6ef5 to your computer and use it in GitHub Desktop.
Save taras/2d49a9d1aa3ddaff6ef5 to your computer and use it in GitHub Desktop.
finalizeQueryParamChange - With A solution
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['test'],
appName:'finalizeQueryParamChange bug example',
actions: {
set_param() {
this.set('test', 'foo');
}
}
});
import Ember from 'ember';
let RedirectAfterTransition = Ember.Mixin.create({
redirectAfterDidTransition(...args) {
this.router.one('didTransition', ()=>{
this.router.transitionTo(...args);
});
}
});
export default Ember.Route.extend(RedirectAfterTransition, {
afterModel() {
this.redirectAfterDidTransition('index');
}
});
<h2>Welcome to {{appName}}</h2>
<br>
<p>When you reload this page with /?test=foo you will see the error in the console.</p>
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment