How to use nested providers?

Hi,
I’m using three Providers in my app: settingsprovider, qrcodeprovider and wsprovider.

  • qrcodeprovider and wsprovider use settingsprovider
  • qrcodeprovider uses wsprovider

“Uses” means that a method of a Provider can call the method of another Provider.

A page can use one or more of these Providers.

Is it correct to import all of them in a Page (if it uses all of them) or this will be a problem in the future?

 constructor(private navCtrl: NavController,
              private navParams: NavParams,
              private settings:SettingsProvider,
              private wsmanager: WsmanagerProvider,
              private qrcodemanager: QrcodemanagerProvider)

Thank you

cld

its totally fine… but keep in mind to not build circular dependencies :slight_smile:

If you need a dependency… load a dependency.
If you do not need it, kick it.

1 Like