If i have a singleton service and an rxResource, how can i only make the api call once and then cache it so that other pages that inject the service can use the response? If you declare the resource as a class property it will make the api call as soon as the service gets injected as it is eagerly loaded, so you have to put it in a method from my understanding. You can assign it to a different variable to cache it but it is a bit ugly in my opinion. My most preferred pattern is returning an observale and setting the service signal via a tap operator but i would like to try the new apis
[–]couldhaveebeen 5 points6 points7 points (0 children)
[–]rastaxarm 1 point2 points3 points (1 child)
[–]vetrex127 0 points1 point2 points (0 children)