-
-
Save pixelhandler/32d83d07597c9a0bcfd1a662e73cbb73 to your computer and use it in GitHub Desktop.
Query params not populated until child model resolves
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| queryParams: ['test'], | |
| test: '<not set by route yet>', | |
| paramValue: 'Not set yet' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Route.extend({ | |
| model() { | |
| return new Ember.RSVP.Promise(function (resolve) { | |
| setTimeout(() => resolve(), 3000); | |
| }); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Route.extend({ | |
| model(params) { | |
| console.log('params.test', params.test); | |
| this.set('paramValue', params.test); | |
| return; | |
| }, | |
| setupController(controller, model) { | |
| this._super(controller, model); | |
| let paramValue = this.get('paramValue'); | |
| controller.set('paramValue', paramValue); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import config from './config/environment'; | |
| var Router = Ember.Router.extend({ | |
| location: config.locationType | |
| }); | |
| Router.map(function() { | |
| this.route('root', function() { | |
| this.route('nested'); | |
| }); | |
| }); | |
| export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.4.16", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "2.1.0", | |
| "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js", | |
| "ember-template-compiler": "2.1.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment