cyberfly
10/1/2018 - 8:38 AM

Angular open link with javascript window.open

import {Observable} from 'rxjs';
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {UrlUtil} from 'Helpers/url-util';
import {ApiService} from 'Services/api.service';
import saveAs from 'file-saver';

@Injectable()
export class DownloadFileService {

    private static base_url: string = '';

    constructor(
      private http: HttpClient
    ) {
        
    }
    
    getNativeWindow() {
        return window;
    }

    downloadFile(file: any) {
      
        // open Google.com in new tab

        this.getNativeWindow().open('https://google.com');
    }
}