Random number on every page-visit

let say i have this on my page one.page.ts:
this.zufall=Math.floor(Math.random() * 5);

->how can i generate a new random number EACH time, a user visit one.page.html ?
(at the moment it generates only once a random number at the first visit, then the number stays the same, now matter how often the users visits one.page.html)

Use ionViewWillEnter().

  ionViewWillEnter() {
    this.zufall = Math.floor(Math.random() * 5);
  }

You can use other life cycle events at NavController Life cycle events section

that works, thx! :slight_smile: