%3cprovider android,我無法獲得$ cordovaFileOpener2以使用我的離子應用程序。

我正嘗試構建一個離子應用程序,用戶在單擊鏈接時在其設備上打開PDF。不過,我發現了以下錯誤鉻

ionic.bundle.js:25642 Error: [$injector:unpr] Unknown provider:

$cordovaFileOpener2Provider

at ionic.bundle.js:13380

at ionic.bundle.js:17574

at Object.getService [as get] (ionic.bundle.js:17721)

at ionic.bundle.js:17579

at getService (ionic.bundle.js:17721)

at Object.invoke (ionic.bundle.js:17753)

at extend.instance (ionic.bundle.js:22311)

at nodeLinkFn (ionic.bundle.js:21421)

at compositeLinkFn (ionic.bundle.js:20853)

at compositeLinkFn (ionic.bundle.js:20857)(anonymous function) @ ionic.bundle.js:25642(anonymous function) @ ionic.bundle.js:22421processQueue @ ionic.bundle.js:27887(anonymous function) @ ionic.bundle.js:27895Scope.$eval @ ionic.bundle.js:29158Scope.$digest @ ionic.bundle.js:28969scopePrototype.$digest @ hint.js:1364Scope.$apply @ ionic.bundle.js:29263scopePrototype.$apply @ hint.js:1427done @ ionic.bundle.js:23676completeRequest @ ionic.bundle.js:23848requestLoaded @ ionic.bundle.js:23789

這裏是我的app.js

angular.module('CCSD_Risk', ['ionic'])

.run(function($ionicPlatform) {

$ionicPlatform.ready(function() {

if(window.cordova && window.cordova.plugins.Keyboard) {

// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard

// for form inputs)

cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

// Don't remove this line unless you know what you are doing. It stops the viewport

// from snapping when text inputs are focused. Ionic handles this internally for

// a much nicer keyboard experience.

cordova.plugins.Keyboard.disableScroll(true);

}

if(window.StatusBar) {

StatusBar.overlaysWebView(true);

StatusBar.style(1); //Light

}

});

});

這是我的控制器main.js

console.log('main.js loaded');

angular.module('CCSD_Risk')

.controller('mainCtrl', function($scope) {

$scope.helloWorld = function() {

console.log('helloWorld');

};

})

.controller('FileOpenerController', function($scope, $cordovaFileOpener2, $ionicPlatform) {

console.log('hi 1');

$scope.openPDF = function() {

console.log('hi');

$cordovaFileOpener2.open(

'flood-plans/cambeiro.pdf', // Any system location, you CAN'T use your appliaction assets folder

'application/pdf'

).then(function() {

console.log('Success');

}, function(err) {

console.log('An error occurred: ' + JSON.stringify(err));

});

};

})

.controller('TestController', function($scope) {

$scope.testConsole = function() {

console.log("this is a working controller");

}

});

我試着加入依賴ngCordova我的app.js文件,但這導致更多的錯誤發生。我不確定此時該做什麼。這是我嘗試用離子建立的第一個應用程序,我對angularJS不太熟悉。如果您需要查看我的其他文件,請告訴我。

+0

添加ngCordova和模塊需要$ cordovaFileOpener2Provider –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值