Skip to content Skip to sidebar Skip to footer

Mustache Inside Of Href

I have JSON like this: { 'something': 'http://something.com' } and HTML like this: {{something}} When I apply Mustache, I get

Solution 1:

Solution 2:

Make sure your template source is straight text - don't try and grab parsed HTML source as your template. Browsers will urlencode/escape those characters in your link href, and result in those %7Bs and %7Ds you see in your code. Mustache won't recognize that.

I suppose unescaping the source you pass to mustache might work, though.

Mustache.render(unescape(source),view)

Post a Comment for "Mustache Inside Of Href"