Single or multiple instances of a provider?

Another newbie question that I could not find an answer to

I seem to have realized that when I call the “same” provider from two different pages, I am getting different instances. Is there a way to have a singleton or do I need to persist data through a storage object and is that the best way? Thx

It depends on where you declare it in a providers array. If at application level, you’ll get a singleton. If at component level, it’s per-component. More here.

1 Like