Angular -How to avoid duplication of RxJS operator imports

in #angular6 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!

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 64689.90
ETH 3450.92
USDT 1.00
SBD 2.50