gokatz
12/19/2016 - 9:53 AM

qp from controller

qp from controller

{
  "version": "0.10.6",
  "EmberENV": {
    "FEATURES": {}
  },
  "options": {
    "use_pods": false,
    "enable-testing": false
  },
  "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
    "ember": "1.13.13",
    "ember-template-compiler": "1.13.13",
    "ember-testing": "1.13.13"
  },
  "addons": {}
}
Page 2 [ <b>QP : {{#unless model}} QP not set {{else}} {{model}} {{/unless}}</b> ]
Page 1 [ <b>QP : {{#unless model}} QP not set {{else}} {{model}} {{/unless}}</b> ]
<h1>Welcome to {{appName}}</h1>

<br>
{{outlet}}

<br>
<br>
<button {{action 'setParam'}}>set param</button>
<button {{action 'goToTwo'}}>transition to TWO</button>

<br>
<br>
import Ember from 'ember';

export default Ember.Route.extend({
  model(params) {
  	return params.test
  }
});
import Ember from 'ember';

export default Ember.Route.extend({
  model(params) {
    console.log(params);
  	return params.test
  }
});

import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
  	setParam() {
    	var twoController = this.controllerFor('two');
     console.log(twoController.get('test'))
twoController.set('test', 'b');
      console.log(twoController.get('test'))
    },
    goToTwo() {
      this.transitionTo('two');
    }
  }
});
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: [
  	'test'
  ]
});
import Ember from 'ember';

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

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