这是我的控制器
.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 :(得分: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();
})