open-vault/ui/app/helpers/nav-to-route.js

16 lines
385 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import Ember from 'ember';
const { Helper, inject } = Ember;
export default Helper.extend({
router: inject.service(),
2018-04-03 14:16:57 +00:00
compute([routeName, ...models], { replace = false }) {
return () => {
const router = this.get('router');
2018-04-03 14:16:57 +00:00
const method = replace ? router.replaceWith : router.transitionTo;
return method.call(router, routeName, ...models);
};
},
});