qp change in detail
{
"version": "0.11.0",
"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.10.2",
"ember-data": "2.11.0",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {}
}
<h1>ONE</h1>
<div style="height: 100px; text-align: center; background: yellow">
content goes here<br>
<button {{action 'selfTransition'}}>Self transition</button>
</div>
<hr>
Page: {{page}}<br>
Per Page: {{perpage}}<br>
<button {{action 'gotoNextPage'}}>Next Page</button>
<h1>Welcome to {{appName}}</h1>
<br>
{{#link-to 'one'}}one{{/link-to}}
<br>
{{outlet}}
<br>
<br>
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
gotoNextPage() {
this.set('controller.page', this.get('controller.page')+1);
},
selfTransition() {
this.transitionTo('one', { queryParams: { page: 1 }});
},
queryParamsDidChange(changed, totalPresent, removed) {
console.log('changed', changed);
console.log('removed', removed);
return this._super(...arguments);
},
}
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('one');
});
export default Router;
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: [
'page',
'perpage'
],
page: 1
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});