-
-
Save Hawksbillcat/e1ab8520fd396713c300cdd1fe7c1755 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async compair_phone_book(){ | |
let test_set=[];//先塞PROMISE給ALL用 | |
let setting=[]; | |
let a; | |
return new Promise((resolve,reject)=>{ | |
this.get_phone_book().then(res=>{ | |
const b =JSON.parse(JSON.stringify(res)); | |
b.map(i=>{ | |
test_set.push(new Promise((resolve,reject)=>{ | |
this.http.get("url/contact="+i).subscribe(res=>{ | |
resolve(res) | |
}) | |
})) | |
}) | |
resolve(test_set)//爬到的是json array | |
}) | |
}) | |
this.compair_phone_book().then(res=>{ | |
console.log(res) | |
//[T,T,T,T] 無法放到promise.all() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment