Skip to content

Instantly share code, notes, and snippets.

@nruth
Last active April 29, 2016 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nruth/93416519a4537be6fb845d88a4ea7a22 to your computer and use it in GitHub Desktop.
Save nruth/93416519a4537be6fb845d88a4ea7a22 to your computer and use it in GitHub Desktop.
ember.js acceptance test window.location redirector abstraction service
import Ember from 'ember';
export default Ember.Service.extend({
redirectTo(href) {
window.location.href = href;
},
replace(href) {
window.location.replace(href);
},
reload() {
window.location.reload();
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
redirector: Ember.inject.service(),
actions: {
foo() {
this.get('redirector').replace('https://www.google.com');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment