我正在尝试为Hybrid应用程序实现HTTPS(带有服务器证书,置于cordova-HTTP插件文档中定义的platform-> android-> asset中)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”不可用!您可能拼错了模块名称,或者忘记了加载它。如果注册模块,请确保将依赖项指定为第二个参数。”

让我知道关于相同的任何建议

最佳答案

添加依赖


  科尔多瓦HTTP


在app.js中

angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives', 'cordovaHTTP'])


希望能解决您的问题。

问候。

10-08 03:43