首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular.js单击下载链接会导致导航到主页

Angular.js单击下载链接会导致导航到主页
EN

Stack Overflow用户
提问于 2013-08-07 02:34:26
回答 1查看 20.4K关注 0票数 3

这是我所拥有的

代码语言:javascript
复制
<div quick-list>
    <br quick-link icon='download-alt' href='{{ getDownloadLink(assignment) }}' text="getMessage('assignmentListStudent.attachment.action.download')">
</div>

与此相关的函数如下

代码语言:javascript
复制
$scope.getDownloadLink = function(assignment) {

    if (!assignment || !assignment.userAttachment || !assignment.userAttachment[0] ) {
        return '';
    }

    return assignment.userAttachment[0].path.replace("equella/items", "equella/force-download/items");
};

我不确定这里出了什么问题,但当我单击下载链接的瞬间,我看到页面导航到主页,在那里它应该下载一个现有的文件。这就是我在chrome中看到的。

代码语言:javascript
复制
 <li class="quick-link ng-scope" quick-link="" icon="download-alt" href="/community/proxy/equella/force-download/items/71c1f5d5-8a1f-4e85-84d6-7560a9e01b63/1/hanks.tomha.24066.PNG" text="getMessage('assignmentListStudent.attachment.action.download')"><a href="/community/proxy/equella/force-download/items/71c1f5d5-8a1f-4e85-84d6-7560a9e01b63/1/hanks.tomha.24066.PNG" class="ng-binding kb-mode"><i class="icon-download-alt"></i>Download</a></li>

现实学生中心(5-15)更新titleInSequence

我有什么地方做错了吗?我应该做些改变吗?任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2013-09-26 04:50:02

这是因为您的路由器可能会将您重定向到主页。

请参阅Angularjs simple file download

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18087902

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档