I have been studying a bit about the Observables in Typescript, specifically in Ionic 3, I understand that to be able to read the data of an Observable I must subscribe to it, but until now I have only been able to use the data within the subscribe
import { DatabaseProvider from '../../providers/database/database'};
import { Observable } from 'rxjs/Observable';
export interface Data{id:string; name:string; dascription:string;}
export class HomePage{
private Datos: Observable<Data[]>:
datos: any[];
constructor(private readonly database: DatabaseProvider){
this.Datos= databse.getDocuments('items');
this.Datos.subscribe(result => this.datos = result);
console.log(this.Datos) // el resultado es undefined
}
}
However, if I create a foreach () with the result variable and start printing the values inside the subscribe if the data appears, some idea of how to get them out of the subscribe