Angular 服务器上的角度后反应窗体

Angular 服务器上的角度后反应窗体,angular,http,post,Angular,Http,Post,您好,我正在尝试向服务器添加一个项目,但我无法将其发送到服务器 下面是一些代码片段 这是我的add组件中的函数,在填写表单时调用它,这里的某个地方是错误的 public onOkClick(priceListItemDTO): void { this.dialogRef.close(); this.itemsService.AddItems(this.profileForm) .subscribe(params => { priceListIte

您好,我正在尝试向服务器添加一个项目,但我无法将其发送到服务器

下面是一些代码片段 这是我的add组件中的函数,在填写表单时调用它,这里的某个地方是错误的

public onOkClick(priceListItemDTO): void {
    this.dialogRef.close();
    this.itemsService.AddItems(this.profileForm)
      .subscribe(params => {
        priceListItemDTO = this.profileForm;
      });
  }
onOkClick在我的项目服务中使用了这个功能(这里可能有错误,但我很确定没有。可能有一点)

public AddItems(priceListItemDTO: FormGroup): Observable<PriceListItemDTO[]> {
  return this.apiService.post<PriceListItemDTO[]>(
  '/price-lists/' + ItemsService.PRICE_LIST_ID + '/items', priceListItemDTO);
公共附加项(priceListItemDTO:FormGroup):可观察{
返回此.apiService.post(
“/price LIST/”+ItemsService.price\u LIST\u ID+”/items',priceListItemDTO);
AddItems使用ApiService这是100%正确的

public post<T>(endpoint: string, params = null): Observable<T> {
    return this.http.post<T>(ApiService.URL + endpoint, params, {headers: this.getRequestHeaders()})
      .pipe(tap(null, err => this.interceptError(err)));
  }
public post(端点:string,params=null):可观察{
返回this.http.post(ApiService.URL+端点,参数,{headers:this.getRequestHeaders()})
.pipe(tap(null,err=>this.interceptError(err));
}
因此,我正在尝试创建另一个我已经尝试过的项目,我确信From是正确的,并且在我尝试使用push的第一个代码段中有一个错误,但我也失败了。
如果您需要我澄清一些事情,我很乐意这样做

正如您所看到的,这需要一些更改

 priceListItemDTO: PriceListItemDTO[];   
     public onOkClick(): void {
            this.dialogRef.close();
            this.itemsService.AddItems(this.profileForm.value)
              .subscribe(params => {
                this.priceListItemDTO.push(this.profileForm.value);
              });
          }
在这里,它只是需要进行排列

public AddItems(priceListItemDTO: FormArray, plu: number): Observable<PriceListItemDTO[]> {
  return this.apiService.post<PriceListItemDTO[]>(
  '/price-lists/' + ItemsService.PRICE_LIST_ID + '/items', priceListItemDTO);
公共附加项(priceListItemDTO:FormArray,plu:number):可观察{
返回此.apiService.post(
“/price LIST/”+ItemsService.price\u LIST\u ID+”/items',priceListItemDTO);

现在一切正常了

您是否检查了网络请求并确认表单数据正在通过网络发送到服务器?您收到了哪些错误?