我正在尝试实现HTTPS(带有服务器证书,置于平台 - > android->资源,如cordova-HTTP插件文档中定义)混合应用程序的Web服务。我已经成功添加了用于android平台的cordova插件。我有 在我的app.js中加载模块:
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives'])
现在我想在controller.js中使用它
angular.module('app.controllers', ['cordovaHTTP'])
.controller('loginScreenCtrl', function($scope) {
console.log('inside Test App controller');
$scope.ShowAlert = function() {
console.log('inside onButtonClick');
cordovaHTTP.enableSSLPinning(true, function() {
console.log('success!');
}, function() {
console.log('error :(');
});
但我已经“无法实例化模块app.controllers,原因是: 错误:[$ injector:modulerr]由于以下原因无法实例化模块cordovaHTTP: 错误:[$ injector:nomod]模块'cordovaHTTP'不可用!您要么错误拼写了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。“exception
让我知道对同一个
的任何建议答案 0 :(得分:1)
添加依赖
app.js 中的cordovaHTTP
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives', 'cordovaHTTP'])
希望能解决你的问题。
问候。