Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('app', { path: ':appid' }, function() {});
this.route('examples', function() {});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model (params) {
const appid = params.appid;
if (appid) {
const title = appid === '1234' ? 'DC' : 'LA';
// TODO: fetch item data by id
// parse out and return the config values
// for now just pretending
const config = {
webmap: `webmap-for-app-${params.appid}`,
title
};
return config;
} else {
this.transitionTo('examples');
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
queryParams: {
appid: {
refreshModel: true
}
},
model (params) {
this.transitionTo('app', params.appid);
}
});
<h2>{{model.title}}'s App</h2>
This app would use webmap w/ id: {{model.webmap}}
TODO: app goes here
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<h2>Examples</h2>
{{#link-to 'application' (query-params appid='123456')}}DC{{/link-to}}
{
"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": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.