: 내가하고 싶은 무엇매개 변수를 사용하여 약속을 묶으시겠습니까?
$scope.parseSomeString = function (str) {
console.log(str);
// ...
};
someService.fnA($scope.arg1) // fnA doesn't return anything
.then(function() {
return someService.fnB($scope.arg2, $scope.arg3()) // fnB returns some, e.g. string
})
.then($scope.parseSomeString); // this shorthand is great!
이 같은 것입니다 :
someService.fnA($scope.arg1)
.then(someService.fnB($scope.arg2, $scope.arg3())) // but of course, this just calls the function; not good
.then($scope.parseSomeString); // this shorthand is great!
인수를 결합 할 수있는 방법 $scope.arg2
및 $scope.arg3()
~ fnB
?
$ q를 꾸미고'.fcall' 구조를 추가 할 수도 있습니다. –