In the Angular Material Docs application, path parameters are combined in the following manner:
// Combine params from all of the path into a single object.
this.params = combineLatest(
this._route.pathFromRoot.map(route => route.params), Object.assign);
For an example, you can refer to: https://github.com/angular/material.angular.io/blob/master/src/app/pages/component-category-list/component-category-list.ts
However, there is an error produced which states:
@deprecated — resultSelector no longer supported, pipe to map instead
To resolve this issue, the code can be adjusted as follows:
this.params = combineLatest(
this._route.pathFromRoot.map(route => route.params)
).pipe(
map(Object.assign)
);
You can find more information on this adjustment here: combineLatest refactoring for @deprecated — resultSelector no longer supported, pipe to map instead?
However, implementing this change results in another error being thrown:
ERROR TypeError: Cannot read property 'name' of undefined at SafeSubscriber._next (component-category-list.ts:50) at SafeSubscriber.__tryOrUnsub (Subscriber.js:183) at SafeSubscriber.next (Subscriber.js:122) at Subscriber._next (Subscriber.js:72) at Subscriber.next (Subscriber.js:49) at MapSubscriber._next (map.js:35) at MapSubscriber.next (Subscriber.js:49) at CombineLatestSubscriber.notifyNext (combineLatest.js:73) at InnerSubscriber._next (InnerSubscriber.js:11) at InnerSubscriber.next (Subscriber.js:49) at BehaviorSubject._subscribe (BehaviorSubject.js:14) at BehaviorSubject._trySubscribe (Observable.js:42) at BehaviorSubject._trySubscribe (Subject.js:81) at BehaviorSubject.subscribe (Observable.js:28) at subscribeToResult (subscribeToResult.js:9)
It seems that after the refactoring, the section
URL parameter that the component relies on is not being captured as expected. Any insights on this?