gokatz
5/30/2017 - 9:02 AM

qp manupulation

qp manupulation

{
  "version": "0.12.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.12.0",
    "ember-template-compiler": "2.12.0",
    "ember-testing": "2.12.0"
  },
  "addons": {
    "ember-data": "2.8.1"
  }
}
<button {{action 'toTwo'}}>TWO</button>
<h1>Welcome to {{appName}}</h1>
<br>
{{link-to 'Home' 'application'}}
{{link-to 'ONE' 'one' (query-params one_qp='111')}}
{{link-to 'TWO' 'two'}}
<br>
<hr>
{{outlet}}
<br>
<br>
import Ember from 'ember';

export default Ember.Route.extend({
});
import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
  	toTwo() {
    	this.transitionTo('two', {
      	queryParams: {
        	two_qp: '222'
        }
      });
      this.set('controller.one_qp', '000');
    }
  }
});
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');
  this.route('two')
});

export default Router;
import Ember from 'ember';

export default Ember.Controller.extend({
  queryParams: ['two_qp']
});
import Ember from 'ember';

export default Ember.Controller.extend({
  queryParams: ['one_qp']
});
import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'Ember Twiddle'
});