angular 6 download files and cancel http request

showDownloadDialog() {
    const subscription = this.alert.custom("Cancel")
        .subscribe(() => {
            this._ngUnsubscribe.unsubscribe();
            subscription.unsubscribe();
        });
}

download() {
    this.showDownloadDialog();
    this._ngUnsubscribe = this.download(this._filterParams).pipe(
        take(1),
        catchError(() => {
            return observableOf();
        })).subscribe((res) => {
			/* 
			* const options = {
	        *    headers: headers,
	        *    responseType: 'arraybuffer'
	        * };
	        * /
            this._alertWindow.close();
            const file = new Blob([res]);
            const url = URL.createObjectURL(file);
            const link = document.createElement("a");
            const fileName = `aa.txt`;
            link.setAttribute("href", url);
            link.setAttribute("target", "_blank");
            link.setAttribute("download", fileName);
            link.click();
        });
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
A hands-on guide with a minimalist and flexible approach that enables quick learning and rapid delivery of cloud-ready enterprise applications with Angular 6 Key Features Explore tools and techniques to push your web app to the next level Master Angular app design and architectural considerations Learn continuous integration and deploy your app on a highly available cloud infrastructure in AWS Book Description Angular 6 for Enterprise-Ready Web Applications follows a hands-on and minimalist approach demonstrating how to design and architect high quality apps. The first part of the book is about mastering the Angular platform using foundational technologies. You will use the Kanban method to focus on value delivery, communicate design ideas with mock-up tools and build great looking apps with Angular Material. You will become comfortable using CLI tools, understand reactive programming with RxJS, and deploy to the cloud using Docker. The second part of the book will introduce you to the router-first architecture, a seven-step approach to designing and developing mid-to-large line-of-business applications, along with popular recipes. You will learn how to design a solid authentication and authorization experience; explore unit testing, early integration with backend APIs using Swagger and continuous integration using CircleCI. In the concluding chapters, you will provision a highly available cloud infrastructure on AWS and then use Google Analytics to capture user behavior. By the end of this book, you will be familiar with the scope of web development using Angular, Swagger, and Docker, learning patterns and practices to be successful as an individual developer on the web or as a team in the Enterprise. What you will learn Create full-stack web applications using Angular and RESTful APIs Master Angular fundamentals, RxJS, CLI tools, unit testing, GitHub, and Docker Design and architect responsive, secure and scalable apps to deploy on AWS Adopt a minimalist,

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值