我想在此作用域函数之外获取“活动”的值,我这样称呼此函数
var active = $scope.GetWorkflows(termin.WFNR);
但是还不确定。预先谢谢你!
$scope.GetWorkflows = function(id){
$http.get("../controller/workflow/read_one.php?id = " + id, config)
.then(function(workflow){
var workflow = workflow.data.records;
return workflow.active;
});
}
您可以更改函数以像这样返回承诺:
$scope.GetWorkflows = function(id){
return $http.get("../controller/workflow/read_one.php?id = " + id, config)
.then(function(workflow){
var workflow = workflow.data.records;
return workflow.active;
});
}
然后称呼它:
$scope.GetWorkflows(termin.WFNR).then((response)=> {
console.log(response);
var active = response;
})