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';
export function querySelector([selector]) {
return document.querySelector(selector);
}
export default Ember.Helper.helper(querySelector);
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('route-a', function() {
this.route('route-b', function() {
this.route('route-d');
});
this.route('route-c');
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.outlet {
border: solid 1px blue;
padding: 10px;
}
#application-outlet {
border-color: red;
}
{{link-to "Route A" "route-a"}}
{{link-to "Route B" "route-a.route-b"}}
{{link-to "Route C" "route-a.route-c"}}
{{link-to "Route D" "route-a.route-b.route-d"}}
<br>
<br>
<div class="outlet" id="application-outlet">{{outlet}}</div>
<br>
<br>
Route A
<div class="outlet">{{outlet}}</div>
{{#-in-element (query-selector "#application-outlet")}}
Route B (rendered in application outlet)
<div class="outlet">{{outlet}}</div>
{{/-in-element}}
Route C (rendered in route-a outlet)
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
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.