-1
我需要幫助理解HTTP承諾鏈。返回並使用鏈接http承諾功能
我想有以下情形:
public class Serv1 extends IServ1 {
public HelpMe() : ng.IHttpPromise<any> {
$http.post(something) -> function(somethingResult) {
// I want to return this promise from this method and use it outside
$http.get(somethingResult)
}
}
}
在我的其他服務,我想使用Serv1.HelpMe
方法:
public class Serv2 extends IServ2 {
public UseHelpMePromise() {
var scope = this;
this.serv1.HelpMe() -> function(resultOfInnerHelpMePromise){
scope.doLogic(resultOfInnerHelpMePromise)
}
}
}
我希望你能幫助我,告訴我哪些關鍵字我應該使用上面代碼中使用的' - >'。 我應該使用.then
還是應該使用.success
?
此外,如果我想返回內部承諾(GET方法承諾),何時應該在HelpMe
方法中放置返回語句?
最後我應該使用.catch
/.error
還是沒有一個?