【发布时间】:2019-08-20 12:39:21
【问题描述】:
我的页面上有 2 个导出按钮,如下所示:
<li ng-click="someFunction.getDownload()">
<export-button>CSV</export-button>
</li> //EXPORT 1
<li ng-click="someFunction.getDownload()">
<export-button>CSV</export-button>
</li> //EXPORT 2
我的页面中有2个<div>这样,当我点击导出按钮时会显示:
<div ng-show="someFunction.loading" class="alert alert-info">Getting data...</div> //ng-show 1
<div ng-show="someFunction.loading" class="alert alert-info">Getting data...</div> //ng-show 2
现在,当我单击 EXPORT 1 或 EXPORT 2 时,我的 <div>s 会同时出现。
我想将 ng-show 1 绑定到 EXPORT 1 并将 ng-show 2 绑定到 EXPORT 2 以便在单击相应导出时只有其中一个出现在 UI 中。
我该怎么做?
【问题讨论】:
-
您是否两次都使用
ng-click调用相同的函数?您还可以显示您的函数someFunction.getDownload()以及someFunction.loading值在哪里更改/更新
标签: html angularjs angularjs-directive frontend