How to use library in Ionic


#1

Hi,

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,
Karthhic


#2

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';

@Component({
  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";
   }
}

#3

Hello,
documentation says you must inject thru your constructor.

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

constructor(private ble: BLE) { }

and you need reference with this

this.ble…

Best regards, anna-liebt