2016-09-18 6 views
0

これは私のコントローラ上記のように、一方のコントローラで関数を実行する方法1つのコントローラでどのように機能を実行するのですか?

.controller('tanyaCtrl', function($rootScope, $ionicPopup, tanyaService, $state) { 

    $rootScope.hal=1; 
    $rootScope.klikBerikutnya = function() { 
     $rootScope.hal=$rootScope.hal+1; 
     //how to run next function after this code..? 
    } 

    //next function 
    $rootScope.showData = function() { 
    tanyaService.getApiTanya($rootScope.getPilihSubTest, $rootScope.hal).success(function(dataAmbil){ 
     $rootScope.Questions = dataAmbil; 
    }); 
    }; 
    $rootScope.showData(); 
}) 

ですか..?

答えて

0

あなたは次のように次に実行する関数を呼び出すことができます。

.controller('tanyaCtrl', function($rootScope, $ionicPopup, tanyaService, $state) { 

$rootScope.hal=1; 
$rootScope.klikBerikutnya = function() { 
    $rootScope.hal=$rootScope.hal+1; 
    //how to run next function after this code..? 
    //just call the function here as follows: 
    $rootScope.showData(); 
} 

//next function 
$rootScope.showData = function() { 
tanyaService.getApiTanya($rootScope.getPilihSubTest, $rootScope.hal).success(function(dataAmbil){ 
    $rootScope.Questions = dataAmbil; 
}); 
    }; 
    $rootScope.showData(); 
}) 
関連する問題