无法从Android发送帖子请求

时间:2019-11-26 09:45:47

标签: javascript angular typescript

我的angular 7应用程序可以在计算机上正常运行,但是可以t send post requests from mobile. here编写代码

myComponent

public onOrderSubmit() {
alert("function started");
if (this.orderForm.invalid) {
  alert("invalid form");
  return;
}
 if (this.orderForm.valid) {
   alert("valid form");
   let payLoad = this.orderForm.value;
   this.OrdersService.newOrder(payLoad).subscribe(response => {
     alert("recived");
     if (response["status"] == 200) {
       alert("success");
       this.OrdersService.notifySuccess("Your order sent");
     } else {
       alert("error");
       this.OrdersService.notifError("Please try again");
     }
     alert("clear...");
     this.orderForm.reset();
     alert("done");
   });
 }
}

myService

public newOrder(payLoad) {
alert("service function started");
return this.http
  .post(this.url + "/order/new", payLoad)
  .pipe(map(response => {
    alert("in map");
    return response
  }))
 }

此功能警报的最后一件事是“服务功能已启动”,但在计算机上工作正常 有什么想法吗?

0 个答案:

没有答案