Property 'length' does not exist on type 'Observable<any[]>

2,285 views
Skip to first unread message

Wira Xie

unread,
Nov 1, 2017, 5:27:53 AM11/1/17
to Angular and AngularJS discussion
Hi, my name is Xie and i am new with Angular.
I got this error when i tried to delete a table row. The table data is from a Json file. 
Here is the error message :  app.component.ts (31,34): Property 'length' does not exist on type 'Observable<any[]>'.
And here is my repository.
Can anyone help me solve this error?
Thank you so much in advance.

Sander Elias

unread,
Nov 1, 2017, 8:33:57 AM11/1/17
to Angular and AngularJS discussion
Hi Wira,

Move your manual HTML manipulation to the use of *ngFor and the template things that go with it, and probably the issue will take care of its own. The whole point of angular is that you don't have to do manual HTML manipulation!

Regards
Sander

Yi Wang

unread,
Dec 3, 2019, 10:53:07 PM12/3/19
to Angular and AngularJS discussion
Hi,I solve a similar problem, my solution is to add ":any[]" after target parameter, for example, I want to get length of array "my_arr", when I declare "my_arr", use "my_arr: any[]"
Reply all
Reply to author
Forward
0 new messages