2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Helper from '@ember/component/helper';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
export default Helper.extend({
|
2018-09-25 16:28:26 +00:00
|
|
|
router: service(),
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
compute([routeName, ...models], { replace = false }) {
|
|
|
|
return () => {
|
2018-07-05 18:28:12 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|