Skip to content

Instantly share code, notes, and snippets.

@tasha-urbancic
Last active April 19, 2020 21:36
Show Gist options
  • Save tasha-urbancic/21306a5ef2c26499733250426bab2599 to your computer and use it in GitHub Desktop.
Save tasha-urbancic/21306a5ef2c26499733250426bab2599 to your computer and use it in GitHub Desktop.
New Twiddle
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
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('broken-segment', { path: ':badId' });
this.route('good-segment', { path: ':good_id' });
});
export default Router;
import Route from '@ember/routing/route';
export default class ApplicationRoute extends Route {
model() {
return {id: 'test', name: 'My thing'};
}
}
<h1>Welcome to {{this.appName}}</h1>
<br>
<br>
<ul>
<li>
<LinkTo
@route="good-segment"
@model={{@model}}
>
"Good url"
</LinkTo>
</li>
<li>
<LinkTo
@route="broken-segment"
@model={{@model}}
>
"Bad url"
</LinkTo>
</li>
</ul>
{{outlet}}
<br>
<br>
<h2>Broken segment</h2>
<h3>{{@model.name}}</h3>
<h2>Good segment</h2>
<h3>{{@model.name}}</h3>
{
"version": "0.17.0",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.17.0",
"ember-template-compiler": "3.17.0",
"ember-testing": "3.17.0"
},
"addons": {
"@glimmer/component": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment