使用$ cordovaImagePicker插件进行离子框架时出错

时间:2015-05-09 12:36:26

标签: javascript angularjs ionic-framework cordova-plugins

我正在尝试使用$ cordovaImagePicker集成图像预览和上传功能。但是当我尝试使用

$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
     });

在我的控制器中它给了我这个错误。

Error: n.imagePicker is undefined
.getPictures@http://localhost/myApp/www/js/ng-cordova.min.js:8:15339
@http://localhost/myApp/www/js/controllers.js:468:13
invoke@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:12877:14 instantiate@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:12885:27
$ControllerProvider/this.$get</<@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:17154:18
self.appendViewElement@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:48176:24
ionicViewSwitcher.create/switcher.render@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:46392:29
ionicViewSwitcher.create/switcher.init@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:46312:11
self.render@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:48050:5
self.register@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:48008:5
updateView@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:53315:11
.compile/</<@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:53292:11
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:23412:15
transitionTo/$state.transition<@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:40882:11
processQueue@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:21881:27
scheduleProcessQueue/<@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:21897:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:23093:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:22909:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:23198:13
done@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:18351:36
completeRequest@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:18541:7
requestLoaded@http://localhost/myApp/www/lib/ionic/js/ionic.bundle.js:18482:1

1 个答案:

答案 0 :(得分:2)

这是一个已知问题。它发生在Image Plugin上。删除您的平台和图像选择器插件。再添加一次。应该解决。