Storage Observable Array


#1

Consider this:

export interface Producao {
    key?: string;
    titulo: string;
    categoria: string;
    descricao: string;
    url: string;
}
  import { Storage } from '@ionic/storage';

  public prods$: Observable<Producao[]>;

Is it possible to store this observable and access his parameters like ‘key’? For example: I would to store one type of Producao (with the key, titulo, categoria, descricao, url) into a local observable array, then store another and another…
Later in my project i want to show this Observable<Producao[]> using ngFor with async. Is this possible?


#2
  prods$.toArray()
  .subscribe(data => console.log(data), console.error);

data should contain the array from the observable which you can then write to storage.

and to get it back, I think you can do something like this

  prods$ = Observable.from(this.storage.get('data'))