Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript TypeError:$ionicLoading.show(…)。then不是函数_Javascript_Angularjs_Ionic Framework - Fatal编程技术网

Javascript TypeError:$ionicLoading.show(…)。then不是函数

Javascript TypeError:$ionicLoading.show(…)。then不是函数,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我试图为任何控制器中的access ionic loader($ionic Loading)创建一个工厂服务。然后发生了错误 “TypeError:$ionicLoading.show(…)。then不是函数” 任何人都能看到我哪里做错了,哪里出错了 控制器: 函数($scope、IonicLoader、$ionicLoading、$ionicPlatform){ //装载离子装载机 IonicLoader.show().then(函数()){ //在这里做些什么 }); }如果您使用的是io

我试图为任何控制器中的access ionic loader($ionic Loading)创建一个工厂服务。然后发生了错误

“TypeError:$ionicLoading.show(…)。then不是函数”

任何人都能看到我哪里做错了,哪里出错了

控制器:

函数($scope、IonicLoader、$ionicLoading、$ionicPlatform){
//装载离子装载机
IonicLoader.show().then(函数()){
//在这里做些什么
});

}
如果您使用的是ionic 1.2版。*请使用
$ionicLoading
作为:

$scope.show = function() {
  $ionicLoading.show({
    // The text to display in the loading indicator
    content: '<i class=" ion-loading-c"></i> ',

    // The animation to use
    animation: 'fade-in',

    // Will a dark overlay or backdrop cover the entire view
    showBackdrop: true,

    // The maximum width of the loading indicator
    // Text will be wrapped if longer than maxWidth
    maxWidth: 200,

    // The delay in showing the indicator
    showDelay: 500
  });
};

$scope.hide = function(){
  $ionicLoading.hide();
};

请参阅。

我能发现但可能不是问题的东西只有:1<代码>持续时间:持续时间,不应有结束逗号;2. <代码>angular.module('IonicLoader.service',[])它不应该包含“离子”依赖项吗?3.您有一个定义模块的
var-IonicLoader
,然后在控制器中注入另一个同名的参数
IonicLoader
-可能有一些冲突Hello Ovidiu,谢谢您的帮助。我试过你提到的那种方法,但仍然不起作用。我不知道这有什么意义-/嗨,奥维迪,再次感谢你!我知道了错误的原因。这都是关于ionic-angular.js版本的。它适用于Ionic v1.3.2!
controller('LoadingCtrl', function($scope, $ionicLoading) {
 $scope.show = function() {
 $ionicLoading.show({
   template: 'Loading...',
   duration: 3000
 }).then(function(){
     console.log("The loading indicator is now displayed");
 });
};

$scope.hide = function(){
  $ionicLoading.hide().then(function(){
     console.log("The loading indicator is now hidden");
  });
 };
});