As this blog posting explains in its first two bullet points myRouter.snapshot.params is a list of parameters at the moment myRouter was spun up and you may get at these without a .subscribe, but you have to use a .subscribe to get at myRounter.params which reflect accurately updates to the params over time. The params will not include route chunks you may have at with Location. The params .subscription will automatically clean itself up when the route is dropped. You don't need to do the ngOnDestroy thing.
No comments:
Post a Comment