@arek_salaso wrote:
Hi all
I got 3 level deep nav views.In the first view I get data from local storage and output a list
page 1
getPrograms() { this.storage.get("fetchedData").then(val => { if (val.hasOwnProperty("programs")) { this.programs = val.programs; for (var i = 0; i < this.programs.length; i++) { if (this.programs[i].exercises.length) { this.exercises.push(this.programs[i].exercises); } } } }); } itemTapped(event, program) { this.navCtrl.push(Exercises, { programs: program }); }
and then in the second view I get data with params from the first view and generate another list (from params data)
page 2this.currentProgram = this.navParams.get("programs"); .....etc . . getExercises() { if (this.currentProgram.hasOwnProperty("exercises")) { this.exercises = this.currentProgram.exercises; } seeDetails(event, exercise) { this.navCtrl.push(ExerciseDetails, { exercises: exercise }); } }
In the third view I get data from the second view with params
page 3this.item = navParams.get("exercises");
and then when user submit some changes and they are posted to external API I do the change to the storage value
getUpdatedData() { this.storage.remove("fetchedData").then(() => { //get refreshed data from endpoint this.programsService.getPrograms(userhash).subscribe(res => { if (res != null && res != undefined) { this.storage.set("fetchedData", res).then(() => { this.loader.dismiss(); this.navCtrl.pop(); }); } }); }); }
So when I pop from the 3 level view e there’s no update in the 2nd level data (storage is changed so this should be somehow reflected in the first view and then passed to second view)
Posts: 1
Participants: 1