我动态显示带有下载某个文件的链接的消息(确实有效):
<a ng-href = "{{myCtrl.fileUrl}}" download = "{{myCtrl.file}}">
{{myCtrl.file}}
</a>
如何关闭(甚至更好 - 在右上角添加交叉)此消息?
答案 0 :(得分:1)
请按照以下步骤操作:
1. Add ng-hide directive to your anchor tag. Example ng-hide="hideLink"
2. Call a function on click of download link. Example ng-click="downloadLinkClicked()"
3. Within the function, set $scope.hideLink = true;
4. Your download link will be hidden now.
代码段:
在你HTML
<a ng-href = "{{myCtrl.fileUrl}}" download = "{{myCtrl.file}}" ng-hide="hideLink" ng-click="downloadLinkClicked()">
{{myCtrl.file}}
</a>
在js
控制器中:
$scope.hideLink = false;
$scope.downloadLinkClicked = function () {
$scope.hideLink = true;
}