Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What is going on with this article?
@saihoooooooo

ionicでcordova pluginをそのまま使う(non-native)

More than 3 years have passed since last update.

あらすじ

https://github.com/pwlin/cordova-plugin-file-opener2showOpenWithDialog()を使いたかったが
ionic-native化されてるやつ( https://ionicframework.com/docs/native/file-opener/ )にはメソッドが無かった :scream: ので調べた

やり方

declare const cordova; を書くだけ
イカのように使う :octopus:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { File } from '@ionic-native/file';

declare const cordova;

@IonicPage()
@Component({
  selector: 'page-hoge',
  templateUrl: 'hoge.html',
})
export class HogePage {

  constructor(private navCtrl: NavController, private navParams: NavParams, private file: File) {
  }

  openFile() {
    const filename = this.file.dataDirectory + 'hoge.pdf';
    const mimeType = 'application/pdf';
    cordova.plugins.fileOpener2.showOpenWithDialog(filename, mimeType)
  }

}

まとめ

バッドノウハウ(笑)

4
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
saihoooooooo
I try it hard day and night to raise the inner product with the vector that there is in the specific point in an endlessly dimensional vector field than anyone else.

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
4
Help us understand the problem. What is going on with this article?