I have declared a variable called authenticated
that I want to use to show or hide a button in a popover. The user should only see the button if he has already authenticated.
I tried the ng-if
with the variable in the h5 part and here it works. I think it is just the formatting inside the string for data-content because when I inspect the page it doesn't use the ng-if
but it shows it in the source code.
<span ng-switch-when="null"
class="redbox label label-primary {{types[charge.Type].CSS}}"
style="cursor:pointer;"
onclick="$(this).popover('toggle')"
data-html='true'
data-toggle="popover"
data-trigger="manual"
data-placement="top"
title="{{"common.BatchStatus-NotPaired"|i18n}}"
data-content="{{ getPopoverTemplate(charge) }}
<a href='#/delete-batch?id={{charge._id}}' class='btn btn-primary btn-block' ng-if='authenticated'><span>{{"common.Delete-Batch"|i18n}}</span></a>">
<h5 ng-if='authenticated'><strong>{{charge.LogicalId}} ({{charge.RfidNullCounter}})</strong></h5>
</span>
` element but does not work in the `` element? And just a side note which might affect the situation is that you're not correctly closing the `` tag. You have the `` element inside the `` tag and you close the span after it. This is not proper HTML structure.
– thepio Sep 30 '16 at 05:50' element but not in the '' element. How could the '' element be insiede the '' tag if I close it before? I don't know if I understand you correct here.
– IAmRoot Sep 30 '16 at 06:03