@deanwilliammills wrote:
Hi
I added a Cordova plugin from GitHub, which is not part of the
ionic-nativeplugins. So plug does show under the list of plugins, so it has been added successfully, but when I call a method from the plugin, I get this error:ReferenceError: CustomPlugin is not defined
Here is my code:
import { Component, OnInit } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;declare var CustomPlugin: any;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage implements OnInit {constructor(public navCtrl: NavController) { }
ngOnInit() {
CustomPlugin.initialise(function () { CustomPlugin.setReceiveScanCallback(function (data, type) { console.log("scan received: " + data + "(" + type + ")"); }); });}
scanBarcode() {
CustomPlugin.requestScan(function () { });}
}
Posts: 1
Participants: 1