I am trying to use the image picker plugin with ionic but it does not work for me.
I followed the instructions from here: Xoilac TV - Website Trực Tiếp Bóng Đá Số 1 VN XoilacTV
I executed: cordova plugin add GitHub - wymsee/cordova-imagePicker: Cordova Plugin For Multiple Image Selection
Successfull installation with android platform, no problem.
But when I try to use the plugin in one controlled, it does not work (im am using the command “ionic run android -l -c” to developing my app).
app.controller(‘ProfileCtrl’, [“$scope”, “$cordovaImagePicker”, function($scope, cordovaImagePicker) {
$scope.$on("$ionicView.enter", function(event) { var options = { maximumImagesCount: 10, width: 800, height: 800, quality: 80 };
$cordovaImagePicker.getPictures(options) .then(function (results) { for (var i = 0; i < results.length; i++) { console.log('Image URI: ' + results[i]); } }, function(error) { // error getting photos }); });
}]);
I got this error:
console-via-logger.js:173 ReferenceError: $cordovaImagePicker is not defined
at controllers.js:405
at Scope.$emit (ionic.bundle.js:24924)
at Object.emit (ionic.bundle.js:50629)
at transitionComplete (ionic.bundle.js:50586)
at onReflow (ionic.bundle.js:50566)
at ionic.bundle.js:26541
at completeOutstandingRequest (ionic.bundle.js:14226)
at ionic.bundle.js:14498
Do I need to add any other reference in the code to use this plugin??
This is my plugins/android.json
{
“prepare_queue”: {
“installed”: ,
“uninstalled”:
},
“config_munge”: {
“files”: {}
},
“installed_plugins”: {
“cordova-plugin-console”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-device”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-splashscreen”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-statusbar”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-whitelist”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“ionic-plugin-keyboard”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-inappbrowser”: {
“PACKAGE_NAME”: “com.mypackagename”
},
“cordova-plugin-image-picker”: {
“PACKAGE_NAME”: “com.mypackagename”
}
},
“dependent_plugins”: {}
}
I tried this solutions:
And to remove and add the same plugin but it does not work.
Please help