I think my question wasn't clear enough. My question is different. The service is being included as the preloading strategy. The interface for preloading strategy(angular.io/api/router/PreloadingSt...) specifies that the method to be overridden is preload. However, here you are including the service as the preloading strategy, which uses startPreload. So I'm just trying to figure out how the preloadingStrategy knows to use the service for preloading? Sort of confused how this all working
I'm not sure I understand, but let me try to see if I follow your question. Angular has the interface PreloadingStrategy which we can implement in a class. This code implements it with export class OnDemandPreloadStrategy implements PreloadingStrategy. So the OnDemandPreloadStrategy must implement the preload method in that interface, which it does with
Ah - I think I see your point ... that last line of code in the article had a typo that didn't match my code. I just fixed it to point to the strategy. Thanks!
Just a name I chose. You could certainly name it the same.
I think my question wasn't clear enough. My question is different. The service is being included as the preloading strategy. The interface for preloading strategy(angular.io/api/router/PreloadingSt...) specifies that the method to be overridden is preload. However, here you are including the service as the preloading strategy, which uses startPreload. So I'm just trying to figure out how the preloadingStrategy knows to use the service for preloading? Sort of confused how this all working
I'm not sure I understand, but let me try to see if I follow your question. Angular has the interface
PreloadingStrategy
which we can implement in a class. This code implements it withexport class OnDemandPreloadStrategy implements PreloadingStrategy
. So theOnDemandPreloadStrategy
must implement thepreload
method in that interface, which it does withThen to use this strategy we must specify a class that implements the strategy, so in the router module we specify
Ah - I think I see your point ... that last line of code in the article had a typo that didn't match my code. I just fixed it to point to the strategy. Thanks!
There we go, that would be it. Thank you.