这是我的按钮的 HTML 代码
<button class="btn btn-outlined " ng-click="vm.showCommentBox1()">Notify All</button>
<div class="comment-box custom saveAll" ng-if=""><div class="panel panel-default">
<div class="panel-heading">
<button type="button" class="close" aria-label="Close" ng-click="comment=true" title="Close comment box"><span aria-hidden="true">×</span>
</button>
<h3 class="panel-title blue-30">Comment</h3>
</div>
<div class="panel-body">
<form>
<div class="form-group">
<textarea class="form-control bg-white" ng-model=""
placeholder="Add your description"></textarea>
</div>
</form>
</div>
</div>
</div>
所以当我单击“x”按钮时,面板应该关闭
最佳答案
只需在所需元素上使用 ng-if="comment===true"
即可在按“x”按钮将 comment 设置为 true 时删除该元素。
关于javascript - 单击 'x' 按钮并使用 angularjs 单击屏幕时如何关闭面板?( Angular 新手),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43133380/