• Post Reply Bookmark Topic Watch Topic
  • New Topic

Angular 2 Development with TypeScript: Question about importing rxjs  RSS feed

 
Ranch Hand
Posts: 90
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read a blog article which discusses how to use the Title service and listen to router events in order to change the page title when the user navigates to another path: https://toddmotto.com/dynamic-page-titles-angular-2-router-events

The article talks about using some features of RxJs and that the sample code requires the following imports:



Indeed, I found that this code sample from the article does not work without importing mergeMap:



The result of the filter() call has type Observable<ActivatedRoute>.

How can importing 'rxjs/add/operator/mergeMap' affect the methods that are available on the Observable type? Does TypeScript have a feature similar to C#'s extension methods?

I saw the Suggestion: Extension methods issue on GitHub, but from one of the comments, it appears that extension methods were not implemented: https://github.com/Microsoft/TypeScript/issues/9#issuecomment-236459998

Is that correct?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!