Skip to content

Instantly share code, notes, and snippets.

@jenweber
Forked from gokatz/controllers.application.js
Last active December 19, 2016 09:53
Show Gist options
  • Save jenweber/ad0b0c2b09a43681ddb6ed595511b1b0 to your computer and use it in GitHub Desktop.
Save jenweber/ad0b0c2b09a43681ddb6ed595511b1b0 to your computer and use it in GitHub Desktop.
qp from controller
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: [
'test'
],
test: "default"
});
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: [
'test'
]
});
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.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';
export default Ember.Route.extend({
model(params) {
console.log(params);
return params.test
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
console.log(params);
return params.test
}
});
<h1>Welcome to {{appName}}</h1>
<br>
{{outlet}}
<br>
<br>
<button {{action 'setParam'}}>set param</button>
<button {{action 'goToTwo'}}>transition to TWO</button>
<br>
<br>
Page 1 [ <b>QP : {{#unless model}} QP not set {{else}} {{model}} {{/unless}}</b> ]
Page 2 [ <b>QP : {{#unless model}} QP not set {{else}} {{model}} {{/unless}}</b> ]
{
"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": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment