Property does not exist on type 'any[]'


#1
[08:52:40]  ngc error: Error: Error at /Users/it/Desktop/Zaki/xxx/.tmp/pages/books-results/books-results.ngfactory.ts:214:51: Property 'SearchAdmittedBooksResult' does not exist on type 'any[]'.
    at check (/Users/it/Desktop/Zaki/xxx/node_modules/@angular/tsc-wrapped/src/tsc.js:31:15)
    at Tsc.typeCheck (/Users/it/Desktop/Zaki/xxx/node_modules/@angular/tsc-wrapped/src/tsc.js:86:9)
    at /Users/it/Desktop/Zaki/xxx/node_modules/@angular/tsc-wrapped/src/main.js:33:23
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Module.runMain (module.js:592:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

public myResponse: any [] = []; //My array
*ngFor=“let x of myResponse.SearchAdmittedBooksResult” //HTML loop

Hey guys, I keep getting this error when i try to ionic run android on compilation
It runs perfectly on Chrome though when ionic serve


#2

Hello,

myResponse is here an empty array, not an object with SearchAdmittedBooksResult property.

If SearchAdmittedBooksResult is a function, which fill up your array, just write :
*ngFor="let x of searchAdmittedBooksResult(myResponse)"


#3

Thanks @mvrc for your reply, Its an Object and inside of it there’s an array called searchAdmittedBooksResult

i fixed it by doing this       
this.myResponse = <Array<any>> ( <Object> response.SearchAdmittedBooksResult);
and HTML
 *ngFor="let x of myResponse"