res.body is coming from api response
if (res.status == 200) {
const data: any = res.body;
this.ncDisplay = data.ncDisplay;
}
This code is checking the status of the res object to see if it is equal to 200. If the status is 200, it is assumed that the response was successful and the data was returned in the body property of the res object. The body property is then assigned to a variable named data of type any. The code then accesses the ncDisplay property of the data object and assigns it to the ncDisplay property of the current object.
If you are still encountering the error "Property 'ncDisplay' does not exist on type 'Object'", make sure that the data object actually has a property named ncDisplay. You can also add type-checking to ensure that the data object has the required property before trying to access it.
Top comments (0)