Angular -How to avoid duplication of RxJS operator imports

in #angular7 years ago (edited)

I love working with RxJS library in Angular when building Reactive app. Sometime it is really easy to forget to import them or sometime duplicate them which in return causing the application with a huge duplication code / library.

It makes sense to create a share import file for all RxJS method that you are going to use. Here is how to do it.

Lets create a typescript file under:  src/app/shared/rxjs-operators.ts 

It should look like this

Then after that, you just need to import rxjs-operators.ts once into your app.component.ts 


That's it.

Sort:  

Congratulations @samuraifc! You received a personal award!

1 Year on Steemit

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @samuraifc! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!