<div class="form-group" ng-if="firstname">
<label>First Name</label>
<input readonly type="text" class="form-control" id="first_name" ng-model="firstname" placeholder="First Name">
<a href="" data-toggle="popover" data-placement="bottom" data-trigger="focus" data-content="User Name" class="glyphicon glyphicon-info-sign infottp"></a>
</div>
我正在使用上面的代码。从那里我通过单击-info-sign glyphicon 显示弹出窗口,我使用 ng-if 条件显示/隐藏而不是 ng-show 和 ng-hide。我的问题是当我使用 ng-if 时,弹出窗口不起作用.但是 popover 在 ng-hide 条件下工作,如果我删除 ng-if 条件。我的问题是为什么 popover 在 ng-if 条件下不工作。
最佳答案
明白了!是,ng-if
阻止渲染 DOM 元素,而 ng-show/ng-hide
仅更改 display
css-poperty
请引用 Angular 文档的第一段ng-if
关于html - angular ng-if with bootstrap popover 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33369099/