title: Bluetooth serial in ionic2, no list of devices
body: <p>I'm using Bluetooth serial in my Ionic2 app and I want to list the possible devices to connect with.</p>
  
  <p>Got this now in the .ts file but doesn't works. I can enable bluetooth but cant list see if he finds the devices or can list them.</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { Platform, AlertController } from 'ionic-angular';
  import { BluetoothSerial } from 'ionic-native';
  import { NavController } from 'ionic-angular';
  
  @Component({
    selector: 'page-page1',
    templateUrl: 'page1.html'
  })
  export class Page1 {
  public working:string;
  public var2: string ;
  public lists = [];
  
    constructor(private alertCtrl: AlertController, public platform: Platform, public navCtrl: NavController) {
      platform.ready().then(() =&gt; {
        BluetoothSerial.isConnected()
          .then(() =&gt; {
            console.log('is connected');
          }, (err) =&gt; {
            console.log(' not connected')
          })
          });
        }
  
  
         enableBluetooth(){
           BluetoothSerial.enable()
           }
           discoverBluetooth(){   
          /*   BluetoothSerial.setDeviceDiscoveredListener(function(device) {
            console.log('Found: '+device.id);
          });*/
           }
           unpairedBluetooth(){
  
           BluetoothSerial.discoverUnpaired().then(function(devices) {
                 devices.forEach(function(device) {
          console.log(device.id)});
              })
  
           }
  
  
    listDevices(){
  
             BluetoothSerial.isEnabled().then((data)=&gt; {
                  console.log(data);
             BluetoothSerial.list().then((allDevices) =&gt; {
              this.lists = allDevices;
  
                  let result = [];
               for (var key in this.lists) {          
                 result.push(key);}
  
             })
  
  
  
  
  })}}
  </code></pre>
  
  <p>And in the .html file I've tried couple of lists to show but nothing of this works out.</p>
  
  <pre><code>&lt;ion-content padding&gt;
  
  
      &lt;ion-buttons&gt;
  &lt;button ion-button (click) = "enableBluetooth()"&gt;Enable!&lt;/button&gt;
  &lt;/ion-buttons&gt;
   &lt;ion-buttons&gt;
  &lt;button ion-button (click) = "listDevices()"&gt;List devices&lt;/button&gt;
  &lt;/ion-buttons&gt;
  Lijst1
  &lt;ion-list&gt;
          &lt;ion-item *ngFor="let list of lists"&gt;{{list.devices}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
      Lijst2
      &lt;ion-list&gt;
          &lt;ion-item *ngFor="let list of lists"&gt;{{list.device}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
      Lijst3
      &lt;ion-list&gt;
          &lt;ion-item *ngFor="let list of lists"&gt;{{list.allDevices}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
      Lijst4
      &lt;ion-list&gt;
          &lt;ion-item *ngFor="let key of lists"&gt;{{list.allDevices}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
      Lijst5
      &lt;ion-list&gt;
          &lt;ion-item *ngFor="let key of lists"&gt;{{key}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
       Lijst
      &lt;ion-list&gt;
          &lt;ion-item *ngFor="let list of lists"&gt;{{list}}&lt;/ion-item&gt;
      &lt;/ion-list&gt;
   &lt;ion-buttons&gt;
  &lt;button ion-button (click) = "unpairedBluetooth()"&gt;Unpair&lt;/button&gt;
  &lt;/ion-buttons&gt;
  &lt;/ion-content&gt;
  </code></pre>