Tuesday, March 7, 2017

underscore template javascript query function

How do you query your data with javascript? I have a helper Javascript file but I can't use it in my template: it throws an error saying that the helper is not defined.

Example code:

<img alt="" src="<%= helper.isURL(images[i].small) ? images[i].small : '/img/' + images[i].small %>">

I tried embedding some raw javascript block with isURL but I still get the same error how do get around this:

<script>function isURL() {}</script>



via ONYX

Advertisement