How to use a plugin without using ionic-native?

I want add the cordova plugin: cordova-plguin-ms-adal. Because this plugin is not supported in the ionic-native. I don’t know how to implement myself, so I open an issue and hope they will merge this plugin very soon.

In the meantime, I can’t wait. So is there any way to use this plugin without using ionic-native?

I tried the following code in my home.ts, but failed to reach.

windows.plugins.Microsoft.ADAL.AuthenticationContext(s);

or directly

Microsoft.ADAL.AuthenticationContext(s);

Note:

  • Microsoft and ADAL are the namespaces of the plugin
  • AuthenticationContext is the function

I think you will need to write your own type declaration files.

I use a plugin called Intercom which is not supported by Ionic-native either. I followed the install steps via its github repo, then just declare var intercom: any; above my @Component declaration. Was then able to simply call the object and it’s methods.

Good luck! :slight_smile:

bit more code for context:

import {Component, Input} from "@angular/core";
import {NavController, MenuController} from "ionic-angular";

declare var intercom: any;

@Component({
selector: "wb-navbar",
templateUrl: "build/components/navbar/navbar.html"
})


openChat() {
intercom.displayConversationsList();
}

2 Likes

Thanks @christoffer_van, it works.

I’m facing the same error than you did.
Could you please help me by posting what variable you declared ?