Skip to content

Instantly share code, notes, and snippets.

@jgwhite
Created September 2, 2015 07:09
Show Gist options
  • Save jgwhite/4194627ebcdcf4d61bfa to your computer and use it in GitHub Desktop.
Save jgwhite/4194627ebcdcf4d61bfa to your computer and use it in GitHub Desktop.
Getting currentRouteName from application controller
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Controller.extend({
needs: ['application'],
appName:'Ember Twiddle',
whereAmI: computed.readOnly('controllers.application.currentRouteName')
});
<h1>Welcome to {{whereAmI}}</h1>
{
"version": "0.4.9",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.11/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment