Last active
July 31, 2018 14:22
-
-
Save nruth/78ec49906ceb23669c5796976ee2c8b1 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy-pasted from the RFC example | |
// https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md#new-method-checking-for-active-route | |
import Helper from '@ember/component/helper'; | |
import { inject as service } from '@ember/service'; | |
import { observer } from '@ember/object'; | |
export default Helper.extend({ | |
router: service(), | |
compute([routeName]) { | |
// this works | |
//return this.get('router').isActive(routeName); | |
// this does not work | |
// and prevents the more complicated version from the rfc example working when a parameterless route is queried, because the empty context object gets passed in and triggers the bug | |
// it only seems to happen on nested routes | |
return this.get('router').isActive(routeName, [], {}); | |
}, | |
didTransition: observer('router.currentRoute', function() { | |
this.recompute(); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('dashboard', {path: '/'}, function() {}); | |
//this.route('wrapper', {path: '/wrapper'}, function() { | |
//this.route('inner', {path: '/inner'}); | |
//}); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.15.0", | |
"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.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment