0

I would like to generate a URL to a resource and show it to the User. I found the link-to but I don't want the whole <a> element but only the URL.

Something like:

{{#url-to 'photos.show' photo}}
fguillen
  • 36,125
  • 23
  • 149
  • 210

2 Answers2

1

I am not sure what Emberjs version you are using but in any case this may work for you. I haven't try my self but probably will help you.

{{#url-to 'photos.show' photo}}

Ember.Handlebars.registerHelper('url-to', function() {
  return Ember.Handlebars.helpers['link-to'].apply(this, args);
});

Check this tutorial which goes more in details. Also you can search for how to create blocs helpers in emebrjs.

Jose CC
  • 865
  • 11
  • 24
0

there is addon which adds such helper {{href-to}} have a look https://github.com/intercom/ember-href-to

Bek
  • 3,157
  • 1
  • 17
  • 28