Error when create alert on ionic


#1

i am trying to use BLE plugin to find bluetooth device, and i want to show
all devices have find.

i have problem when i try to create an alert box to show my Bluetooth data.
this is the error when i try to deploy on IOS.


and here is my code, i cannot see any problem on my code

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { BLE } from '@ionic-native/ble';
import { AlertController } from 'ionic-angular';

/**
 * Generated class for the WalkieTalkiePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-walkie-talkie',
  templateUrl: 'walkie-talkie.html',
})
export class WalkieTalkiePage {

  constructor(private ble: BLE, public alertCtrl: AlertController) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad WalkieTalkiePage',);
  }

  startScan(){
  	var searchedDevices = this.ble.startScan([]);
  	console.log(searchedDevices);

  	let alert = this.alertCtrl.create({
      title: 'New Friend!',
      subTitle: searchedDevices,
      buttons: ['OK']
    });
    alert.present();
  }

}

thanks for the time to reading this


#2

The error seems to have wrapped it up for the most part.

searchedDevices is an observable, and subTitle is expecting a string.