服务器帖子
GetListNickNameByNameAndID(name:string,id:string):Promise<any>{
//send api link to server
return this._http.post(this.apiUrlgetNick+'?userName='+name+'&serverId='+id,{headers:new JsonHeaders()})
.map((response:Response) => response.json()).toPromise();
}
在Component
中调用服务器帖子 checkApi(){
this.getItemService.GetListNickNameByNameAndID('admin','1').then((respone:any)=>{
console.log(respone);
})
}
代码html
<button (click)="checkApi()" class="btn btn-success" type="button">Check</button>