0

This is my code for get data from database - works. I get data no problem, but i have this message " error TS2339: Property 'ReturnValues' does not exist on type 'Object'. " Why i have this error message?

import {HttpClient} from '@angular/common/http';
import {Component, OnInit} from '@angular/core';


@Component({
    selector: 'app-product',
    templateUrl: './product.component.html',
    styleUrls: ['./product.component.css']
})

export class ProductComponent {

    title: string;

    constructor(private http: HttpClient) {

    }

    ngOnInit(): void {


        this.http.post('myUrl for request', {
            APIVersion: '1',
            Calls: [{
                Function: 'getObject', Arguments: [
                    "Customer", [{
                        "column": "customerID",
                        "value": '0',
                        "operator": ">"
                    }],
                    [], //Sort Array
                    "", //Page
                    "", //Limit
                    []
                ]
            }],
            Authentication: {
                AccessToken: '7644c600394f1e23512c90602d5c78ca'

            }
        }).subscribe(data => {
               console.log(data.ReturnValues[0].items)
            //  this.title=data.ReturnValues[0].items;
        }, err => {console.log(err)})
    }

}
  • 1
    Possible duplicate of [Angular 4 - Http to HttpClient - property 'someproperty' does not exist on type Object](https://stackoverflow.com/questions/47202177/angular-4-http-to-httpclient-property-someproperty-does-not-exist-on-type) – jonrsharpe Jun 12 '18 at 13:18
  • Check the structure of `data` in your `.subscribe()`. The property `ReturnValues` doesn't exist. – p4r1 Jun 12 '18 at 13:22
  • You are getting this error because API response not constants ReturnValues as a key in response JSON. – Mikinj Mistry Jun 12 '18 at 16:13
  • in order to debug console the data and then check ReturnValues is an array in your output – Vignesh Jun 13 '18 at 01:33
  • console.log(data.ReturnValues[0].items) this is return data from my api array of objects.I not have with get my data, my problem is ReturnValues[0].items - error TS2339: Property 'ReturnValues' does not exist on type 'Object – stency Gergiev Jun 13 '18 at 08:59

0 Answers0