msSaveOrOpenBlob method will only work for the IE browser. The method that works for other browsers like Mozilla and Chrome will not work in the IE browser.
You need to detect the IE browser using code and then try to use msSaveOrOpenBlob method. If the browser is not IE then you can use the method that works for other browsers.
You can check the example below for downloading the Blob file. You can make a test with this example to see whether it is working as per your requirement or not.
App.component.ts
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
name = 'Angular 5';
fileUrl;
constructor(private sanitizer: DomSanitizer) { }
ngOnInit() {
const data = 'some text';
const blob = new Blob([data], { type: 'application/octet-stream' });
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(blob));
}
}
Stackblitz live example