Skip to content

Instantly share code, notes, and snippets.

@cafreeman
Last active September 18, 2018 22:24
Show Gist options
  • Save cafreeman/6d2b17d81c92abd5299ea8d434124381 to your computer and use it in GitHub Desktop.
Save cafreeman/6d2b17d81c92abd5299ea8d434124381 to your computer and use it in GitHub Desktop.
QueryParam + ControllerName Issue
import Ember from 'ember';
export default Ember.Component.extend({
router: Ember.inject.service(),
wasClicked: false,
actions: {
go() {
this.set('wasClicked', true);
this.get('router').transitionTo('child');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['foo']
});
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('child');
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
controllerName: 'application'
});
{{transition-component}}
This is the child route.
<h3>Clicking the button will call <code>RouterService#transitionTo('child')</code>.</h3>
<button onClick={{action "go"}}>Go</button>
{{#if wasClicked}}
<p>
Now, note that we are still on <code>/</code>, not <code>/child</code>. In addition, check your console and you should see the following error:
<br>
<br>
<code>Assertion Failed: You passed the `application:foo` query parameter during a transition into child, please update to foo</code>
</p>
{{/if}}
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment