Нижеприведенный код поможет вам открыть вложение (файл в новом окне) без блокировки всплывающих окон
getPdf(projectId) {
let newWindow = window.open();//OPEN WINDOW FIRST ON SUBMIT THEN POPULATE PDF
this.http.get(environment.apiUrl + "/PROJECT/getPdf/" + projectId + '/' + this.userDataSession.userDetailsId + '/' + 9 + '/' + this.authService.getUserToken(), { responseType: 'blob' })
.subscribe((blob: Blob) => {
let file = new Blob([blob], { type: 'application/pdf' });
let url = URL.createObjectURL(file);
this.router.navigate([url]);
newWindow.location.href = url;//POPULATING PDF
});
}
Вы могли попробовать это:
using System.IO;
using System.Reflection;
namespace Utilities
{
static public class DirectoryHelper
{
static public string GetCurrentDirectory ()
{
return Path.GetDirectoryName (Assembly.GetExecutingAssembly ().GetName ().CodeBase);
}
}
}
Попробуйте это:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);