HI,
i have a question.
I'm trying to use ionic native in my Ionic 1 project.
but when it try
$cordovaTransfer.upload()
i receive the errro
Uncaught TypeError: $cordovaTransfer.upload is not a function
here is my code
` cordovaUpload: function (file, objectType, fileName, chunkMode) {
chunkMode | (chunkMode = false);
var container = this.fileContainer(objectType);
var options = {
fileKey: "file",
fileName: fileName,
chunkedMode: chunkMode,
mimeType: "image/jpg"
};
$cordovaTransfer.upload(file, CONFIG.urlApi + '/api/containers/' + container + '/upload', options).then(function(data){
return data;
});
}`
Hey there,
This plugin (and a few others) is instance based. You need to do something like the following:
var transfer = new $cordovaTransfer();
transfer.upload(...);
Hi @ihadeed thank you for the answer.
But i tried that one and got a error too
cordova.js:314 Uncaught TypeError: $cordovaTransfer is not a constructor
@mlynch can you have a look at this when you get a chance?
Ah, perhaps the instance based stuff isn't correctly abstracted for ng1...
@felipetoffolo1 can you try to use the plugin via the global variable IonicNative..
example:
var transfer = new IonicNative.Transfer();
transfer.upload(...)
@ihadeed tried your latest example, but doesn't work. No error in console, but nothing happened too
The constructor isn't getting carried over, fixing now
Most helpful comment
Hey there,
This plugin (and a few others) is instance based. You need to do something like the following: