Using ember linkTo from controller

987 Views Asked by At

I have a fairly complex text that I need to generate programmatically for display within an ember template. So far I have put this text construction into a controller.

Unfortunately, the text also needs to contain hyperlinks to other pages within the same ember app. When I just insert a href links into the text, ember does not recognize those links and triggers a full page reload upon following the link.

Is there a way to invoke ember's linkTo helper from within a controller?

I could also try to put this into a template, but the logic is fairly complex and emblem is somewhat limiting in this regard.

1

There are 1 best solutions below

0
On

You can use an action in the template and inside the action you can do this.transitionToRoute

http://emberjs.jsbin.com/uMeQAvuk/1/edit

BTW, the only reason it should be causing a full page refresh is if something is different in the base url (before the hash) than the current page, or if it is doing some sort of page refresh instead of just an anchor tag.