Skip to content

Instantly share code, notes, and snippets.

@mydea
Created June 2, 2016 20:10
Show Gist options
  • Save mydea/5b089e763376bf13b0e241638fc0163f to your computer and use it in GitHub Desktop.
Save mydea/5b089e763376bf13b0e241638fc0163f to your computer and use it in GitHub Desktop.
Child Query Params
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
queryParams: ['myParam'],
myParam: null
});
import Ember from 'ember';
export default Ember.Controller.extend({
myParam: null
});
import Ember from 'ember';
export default Ember.Controller.extend({
myParam: null,
});
import Ember from 'ember';
export default Ember.Controller.extend({
//queryParams: ['myParam'],
myParam: null
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none'
});
Router.map(function() {
this.route('parent-route', function() {
this.route('child-route');
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
setupController(controller, model) {
let childController = this.controllerFor('parent-route.index');
childController.set('myParam', controller.get('myParam'));
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
Parent Route param: {{myParam}}
<br><br>
{{outlet}}
<br><br>
{{#link-to 'application' (query-params myParam='TEST')}}
Test Query Param
{{/link-to}}
The param value is: {{myParam}}
Parent Route param: {{myParam}}
<br><br>
{{outlet}}
The param value is: {{myParam}}
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment