Skip to content

Instantly share code, notes, and snippets.

@srvance
Created July 19, 2016 02:48
Show Gist options
  • Save srvance/4cc1013afac86cebc0911c3e058ba999 to your computer and use it in GitHub Desktop.
Save srvance/4cc1013afac86cebc0911c3e058ba999 to your computer and use it in GitHub Desktop.
Window Location
import Ember from 'ember';
export default Ember.Controller.extend({
windowLocation: Ember.inject.service(),
appName: 'Window Location',
init() {
console.log('application.js');
this.get('windowLocation').location();
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
windowLocation: Ember.inject.service(),
init() {
console.log('index.js');
this.get('windowLocation').location();
}
});
import Ember from 'ember';
export default Ember.Service.extend({
location() {
console.log('router.url = ' + this.get('router.url'));
console.log('window.location = ' + window.location);
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{
"version": "0.10.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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment