【问题标题】:cordova-plugin-inappbrowser not working from angularcordova-plugin-inappbrowser 不能从角度工作
【发布时间】:2019-07-12 07:08:42
【问题描述】:

我正在尝试打开 pdf 一个通过 api 从 angular cordova 应用程序接收到的文件。

this.laccountservice.downloadPDF(order).subscribe(
      (res) => {
      var files=  new Blob([res], { type: 'application/pdf' })
        console.log(files)
      var fileURL = URL.createObjectURL(files);
      //window.open(fileURL); // if you want to open it in new tab
     cordova.InAppBrowser.open(fileURL, '_blank', 'location=yes');

如何定义科尔多瓦? 从“cordova-plugin-inappbrowser”导入{}?我没有使用phonegap cordova的离子简单角度应用程序

【问题讨论】:

    标签: angular typescript cordova


    【解决方案1】:

    您可以通过以下方式使用cordova instance

    (window as any).cordova.InAppBrowser.open(fileURL, '_blank', 'location=yes');
    

    import { Component } from '@angular/core';
    
    declare var cordova:any;
    
    @Component({
      selector: 'my-app',
      templateUrl: './app.component.html',
      styleUrls: [ './app.component.css' ]
    })
    
    export class AppComponent  {
    
      constructor() {
        cordova.InAppBrowser.open(fileURL, '_blank', 'location=yes');
      }
    
    }
    

    【讨论】:

    • 亲爱的我无法打开pdf文件
    • 但是,您的问题是如何声明cordova?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 2023-03-11
    • 2016-04-07
    • 1970-01-01
    • 1970-01-01
    • 2019-11-07
    • 1970-01-01
    相关资源
    最近更新 更多