I have the following JS code:
{var c;a.stores=[{name:"Nijiya Market",price:"$$",sales:292,rating:4},{name:"Eat On Monday Truck",price:"$",sales:119,rating:4.3}]
I call on these variables to produce an html table. What I want to do is use html within the JS variable to produce an image instead of text. So for example:
{var c;a.stores=[{name:"<img src='url'>",price:"$$",sales:292,rating:4},{name:"<img src='url'>",price:"$",sales:119,rating:4.3}]
Can anyone suggest how I do this and if the same method would work with php.
Don't know if it matters, but I am using AngularJS.
Thanks.
ng-bind-html
to pass<img>
to template because it isn't text. Angular expressions only take text. But would make more sense to just send the url and useng-src
in an image tag within the template. Suppose you wanted a css class later on the images...would only need to add it once in template and not have to update your database or php or whatever is now creating that<img>