Skip to content

Instantly share code, notes, and snippets.

@sohara
Created April 20, 2018 19:35
Show Gist options
  • Save sohara/556a2501bb501eb4c03576f318f32a2b to your computer and use it in GitHub Desktop.
Save sohara/556a2501bb501eb4c03576f318f32a2b to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
router: Ember.inject.service()
});
import Ember from 'ember';
export default Ember.Controller.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
categoryController: Ember.inject.controller('categories.category'),
categoryModel: Ember.computed.reads('categoryController.model')
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('categories', function () {
this.route('category', {path: ':category_id'} );
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model (params) {
return params.category_id;
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<h3>Current Route: <span style="font-family:monospace">{{router._router.currentRouteName}}</span></h3>
{{#link-to 'categories'}}Categories{{/link-to}}
{{outlet}}
<br>
<br>
<h3>Categories Page</h3>
{{categoryController}}
{{category-browser category=categoryModel}}
<h3>Category Browser</h3>
{{#link-to 'categories.category' 2}}Category 2{{/link-to}}
<h4>Current Model: {{category}}</h4>
{
"version": "0.13.1",
"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.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment