# Dependency injection of modules which are not browser supported

**URL:** <https://forum.ionicframework.com/t/dependency-injection-of-modules-which-are-not-browser-supported/77679>\
**Category:** ionic-v3\
**Created:** [January 28, 2017, 12:05pm UTC](https://forum.ionicframework.com/t/dependency-injection-of-modules-which-are-not-browser-supported/77679 "2017-01-28T12:05:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajeevriitm](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rajeevriitm](https://forum.ionicframework.com/u/rajeevriitm)\
**Post date:** [January 28, 2017, 12:05pm UTC](https://forum.ionicframework.com/t/dependency-injection-of-modules-which-are-not-browser-supported/77679/1 "2017-01-28T12:05:36Z")

</div>

I am using `Transfer` plugin from `ionic-native` in my app. I would like to inject it into the app so that testing becomes easier. In `app.module.ts`

`providers: [Transfer]`

But `Transfer` is a cordova plugin which is not browser supported. So this would fail in development and test. So I would like to mock the plugin if it is in browser . Here is a mock on how I would like to implement it.

```
const TRANSFER_PROVIDER: any;

if (environment.browser) {
  TRANSFER_PROVIDER = Transfer;
} else {
  TRANSFER_PROVIDER = { provide: Transfer, useClass: NativeTransfer }
}

...
providers: [TRANSFER_PROVIDER]

```

But how can I check if its in browser or not in `ionic 2` ? Or Is there any other way to implement this logic?
