我有“角度工厂”和“角度控制器”。角度同步http请求
当我在控制器功能中调用时,从工厂函数调用。 但是控制器功能不是等待响应。
这是我的代码。
$scope.deleteCountry = function (countryId, countryName, index) {
alert(countryId + " " + countryName + " " + index);
apiUrl = url + '/' + version + '/country';
$scope.hasDelete = CommonFactory.deleteEntById(apiUrl,countryName,countryId);
alert($scope.hasDelete);
if ($scope.hasDelete == true) {
$scope.dataList.splice(index, 1);
ShowMessage('Hata', 'Silme işlemi başarılı', 1);
}
else {
ShowMessage('Hata', 'Silme işlemi başarılı değil', -1);
}
}
您可以为此执行Promise或回调。根据您的选择,您可以实施。 –