You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs(aio): Testing: Description and code don't match #16064
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
The code example is a single line using subscribe:
The description talks about the usage of pluck and forEach. They aren't used (probably anymore) in the code. This is misleading.
The expression after route.params chains an Observable operator that plucks the id from the params and then chains a forEach operator to subscribe to id-changing events. The id changes every time the user navigates to a different hero.
The forEach passes the new id value to the component's getHero method (not shown) which fetches a hero and sets the component's hero property. If the id parameter is missing, the pluck operator fails and the catch treats failure as a request to edit a new hero.
Screenshot
Expected behavior
The description should match the code. The description should be replaced or removed.
Activity
kapunahelewong commentedon Feb 23, 2018
@jenniferfell This issue might be resolved in #20697.
jenniferfell commentedon May 29, 2018
Closing. Doc and example were updated at some point to use paramMap.subscribe instead of the code above:
ngOnInit(): void {
// get hero when
idparam changesthis.route.paramMap.subscribe(pmap => this.getHero(pmap.get('id')));
}
filename=https://angular.io/guide/testing
angular-automatic-lock-bot commentedon Sep 13, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.