Skip to content

Instantly share code, notes, and snippets.

@GCheung55
Last active August 16, 2018 06:31
Show Gist options
  • Save GCheung55/207c284d8d37a87d9839352e842c7548 to your computer and use it in GitHub Desktop.
Save GCheung55/207c284d8d37a87d9839352e842c7548 to your computer and use it in GitHub Desktop.
Demonstrate getting current path from controller
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default Controller.extend({
router: service(),
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<ul>
<li>
target.currentPath: {{target.currentPath}}
</li>
<li>
router.currentRouteName: {{router.currentRouteName}}
</li>
</ul>
{
"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