720kb / angular-tooltips

Angularjs tooltips module, add tooltips to your elements - https://720kb.github.io/angular-tooltips
351 stars 157 forks source link

Tooltip template how to escape quotes? #211

Closed deepank411 closed 7 years ago

deepank411 commented 7 years ago

I enclosed the tooltip-template with single quotes and used double quotes inside to assign classes to the HTML tags, but in the span tag I have to conditionally add a class that has to be within quotes themselves according to angular syntax, which leads to an error on the page.

<span tooltips tooltip-side="bottom" tooltip-size="large" tooltip-class="t-tooltip" tooltip-template='
    <div>
        <span class="{{ detail.price_available == 1 ? 't-strikethrough' : ' '}}">NOT WORKING</span>
    </div>
'>
</span>

Is there some way to escape the single quotes inside the tooltip-template or any secondary quotes that can be used instead of the single quotes at that location. I have already tried using backticks and reverse slash to escape the single quote to no avail.

45kb commented 7 years ago

@deepank411 You should usetooltip-template-url="path/to/tooltip.html" when you have logic in your html.

Maybe you could try with angular $sanitize but i did not tried.

deepank411 commented 7 years ago

using a relative path along with tooltip-template-url worked. Thanks!