How can I get the state of the previous PAGE?

I’m a newbies of ionic and angularjs。How can I can’t a the data of other PAGEs?

  1. router parameters?
  2. state Management, like vuex in Vue?
  3. local storage?
  4. or something else?

I don’t think “accessing the data of another page” is a very helpful way of thinking in Angular. If you want to share data amongst multiple pages, create a service provider, store it there, and inject that provider in every involved page.

Thanks for your answer. I found that ‘NavParams’ is what I want…

I would agree use a service provider and not NavParams.

@rapropos Don’t you just love it - you provide excellent advice and it just gets ignored!

1 Like

sorry for that …

@navych2020 I apologise if my remark offend you.
It was not aimed at you personally but on the excellent advice that @rapropos provides free of charge.

ok, let’s forget it. :slight_smile:

@JAR19 @rapropos Is the service like this?

export class PointService {
  getPoint():  {

How can I share data, eg: localPoint, among pages? Like this?

export class PointService {
    localPoint: any;

How can I ensure each service share ONE instance?

If you can tell me some website or open source project about this, I’ll happy to learn by myself.

Thanks :slight_smile:

Making sure you have no providers on any components, only in the app module. Oh, and define a proper type instead of abusing any.

I would suggest:

@rapropos @JAR19 Thanks for your help