How to use library in Ionic



I am new to ionic, I want to create a function() and when pressing a button that function should run.

I have installed cordova library, but when i am trying to use it its not at all working.

I need help

Thank you,

Best Regards,


What is wrong with this code?
Is there any link to learn about this?

Library is imported but when i try to us it its showing error
how i try to use the library:
BLE.scan(services, seconds, success, failure);

my code

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { BLE } from '@ionic-native/ble';
import { discover } from 'cordova-plugin-discovery';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {

  constructor(public navCtrl: NavController) {  }

   public blue(){
    //BLE.scan(services, seconds, success, failure);
    document.getElementById("scn").innerHTML = "scanning";


documentation says you must inject thru your constructor.

import { BLE } from ‘@ionic-native/ble’;

constructor(private ble: BLE) { }

and you need reference with this


Best regards, anna-liebt