Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Angular GET Method Null Reference

In my app, I'm trying to display a list of elements. For this, I have to make a get call with 2 parameters to back-end. I get a Null Reference in Visual Studio when I open the page. Here is the code. So far I've done this, but I don't know how to solve the error. What should I do to fix it?

Service TS:

getWorkItemStockTransactionList(filter: IFilter): Observable<IStockTransaction[]> {
    return this._httpOrder.get('Order/GetWorkItemStockTransactionList/'+ filter);
}

TS:

  transactionList: IStockTransaction[] = [];

  private _selectedWorkItem: IWorkItem;
  Filter: IFilter;
  @Input()
  set StockTransaction(prm: IWorkItem) {
      if (this._selectedWorkItem != prm) {
          this._selectedWorkItem = prm;
                  
          this.dataSource = new MatTableDataSource(this.transactionList);        
          this.getWorkItemStockTransactionList((this._selectedWorkItem.Product.ProductId) , (this.Order.OrderId));
      }
  }
  @Input() Order: IOrder;
   getWorkItemStockTransactionList(productId , orderId) {
    this._orderService
        .getWorkItemStockTransactionList(this.Filter)
        .subscribe((response: IStockTransaction[]) => {
            this.dataSource = new MatTableDataSource(response);
            this.transactionList = response;
        });
  }

Back-end:

        [HttpGet]
            public List<DtoStockTransaction> GetWorkItemStockTransactionList(DTOFilter dTOFilter)
            {
                return StockSpProvider.GetWorkItemStockTransactionList(dTOFilter);
            }
    
            public static List<DtoStockTransaction> GetWorkItemStockTransactionList(DTOFilter prm)
            {
//this is where I get the error
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@ProductId",prm.Product.ProductId),
                    new SqlParameter("@OrderId",prm.Order.OrderId)
                };
    ...
    }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!