FileTransfer is not defined

2019-09-15 16:13发布

问题:

I am using Transfer plugin in my ionic 2 app for sending files. While testing the app, I had difficulty in mocking Transfer. Please take a look into this problem to understand the context . After that discussion , I decided to inject Transfer in my service.

So I added Transfer in my providers in app.module.ts.And injected it into my service.

constructor( public transfer: Transfer){}

But this leads to an error. FileTransfer is not defined. I guess its because there is no browser support for this plugin. So I am in a tough spot, I do not know how I can make working testable code. Any ideas?

回答1:

In ionic cordova plugin are not supported for browser Because the browser cant access native api of the os so you need to develop the app and deply it in your Android or ios device .