Previous data is displayed during data transfer between pages

#1


Ionic 4.9.0

please HELP:

html: page 1

  <ion-segment scrollable [(ngModel)]="value">

    <ion-segment-button value="site1"
    (click)="pushUploaderS()">
        <ion-label>Site1</ion-label>
    </ion-segment-button>
    
    <ion-segment-button value="site2"
    (click)="pushUploaderS()">
        <ion-label>Site2</ion-label>
    </ion-segment-button>
    
    <ion-segment-button value="site3"
    (click)="pushUploaderS()">
        <ion-label>Site3</ion-label>
    </ion-segment-button>

    <ion-segment-button value="site4"
    (click)="pushUploaderS()">
        <ion-label>Site4</ion-label>
    </ion-segment-button>

    <ion-segment-button value="site5"
    (click)="pushUploaderS()">
        <ion-label>Site5</ion-label>
    </ion-segment-button>

    <ion-segment-button value="site6"
    (click)="pushUploaderS()">
        <ion-label>Site6</ion-label>
    </ion-segment-button>

    <ion-segment-button value="site7"
    (click)="pushUploaderS()">
        <ion-label>Site7</ion-label>
    </ion-segment-button>

  </ion-segment>

ts: page 1:

import { Component } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  value = '';

constructor(
  private router: Router){

}
pushUploaderS(){
  this.router.navigate(['/uploader', this.value ]);
}


}

html: page 2:

  <p>{{value}}</p>

ts: page 2:

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-uploader',
  templateUrl: './uploader.page.html',
  styleUrls: ['./uploader.page.scss'],
})
export class UploaderPage implements OnInit {

  value = null;
  constructor(
    private activatedRoute: ActivatedRoute
  ) {
  
   }

  ngOnInit() {
   
    this.value = this.activatedRoute.snapshot.paramMap.get('id');
  }


}

and I have already imported FormsModule in app.module.ts

current result: page 2 shows the data previously chosen

expected result: Page 2 shows the data chosen during the click on the value chosen in that instance

#2

same problem! :frowning: