1

Here is my code. I'm trying to display a list when a property is selected from a combobox. I'm getting the list from backend, but I get this error whenever I click the display button. Even though, the method is a GET method. What could be the problem?

enter image description here

TS:

filter() {
    this._stockService
      .getWarehouseTransferReport()
      .subscribe((response: any) => {
        this.dataSource = new MatTableDataSource(response);
        this.dataSource.paginator = this.paginator;
        this.dataSource.sort = this.sort;
        this.dataSource.filterPredicate = (data, filter) =>
          this.filterPredicate(data, filter);
      });
  }


  filterPredicate(data: IWarehouseTransferItem, filter: string) {
    let searchText = data.Reference;
    if (data.Reference) {
      searchText += (data.Reference as any).toLocaleLowerCase("tr");
  }
    if (data.DeliveryNote) {
        searchText += (data.DeliveryNote as any).toLocaleLowerCase("tr");
    }
    if (data.StockIntegrationCode ) {
        searchText += (data.StockIntegrationCode  as any).toLocaleLowerCase("tr");
    }
    if (data.Product.ProductName) {
        searchText += (data.Product.ProductName as any).toLocaleLowerCase("tr");
    }

    return searchText.indexOf(filter) >= 0;
}

Service TS:

getWarehouseTransferReport(): Observable<IWarehouseTransferItem[]> {
    return this._http.get("Stock/GetWarehouseTransferReport");
}

Backend C#:

 /// <summary>
        /// TRANSFER REPORT
        /// </summary>
        /// <param name="producdId"></param>
        /// <returns></returns>
        [HttpGet]
        public List<DtoWarehouseTransferItem> GetWarehouseTransferReport(int producdId)
        {
            return WarehouseSpProvider.GetWarehouseTransferReport(producdId);
        }
    }
1
  • Did you try to call the GetWarehouseTransferReport API with Postman and see the result? Commented Jun 14, 2021 at 10:25

3 Answers 3

1

It probably means that server know the method but the target source is not supported. Here is the reference Mozilla link.
So basically it is not Angular Http client problem to be precise.

Reference link which shows many details on 405 status code problem. Link

Sign up to request clarification or add additional context in comments.

Comments

0

Your C# Backend code requires a parameter int productId but I think you are not passing any parameter that's why it is now being called.

Comments

0
  • May be you are passing wrong object or object mismatches the value.
  • may be datatype issue or parameter count issue and your API needs proper object and value.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.