I would like to know how to pass data from one item to a form in another view using Native LocalStorage from Ionic 3.
I created a provider as shown below:
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
/*
Generated class for the MovimentosProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class MovimentosProvider {
lista:any[];
chave:string = "movimentos";
constructor(private storage: Storage) {
this.storage.ready().then(()=>{
this.storage.get(this.chave).then((registos) =>{
if(registos){
this.lista = registos;
}else{
this.lista = [];
}
});
});
}
listar(){
return this.lista;
}
adicionar(registro:any){
this.storage.ready().then(()=>{
this.lista.push(registro);
this.storage.set(this.chave, this.lista);
});
}
}
And I have a button editarMovimento
but I want to pass what I captured from the listing to the form and can edit it.
editarMovimento(movimento:IMovimento){
this.movimento = movimento;
}
How can I do this?