Varma harry
Varma harry

Reputation: 41

cannot read property 'dispose' of null angular 4

I am using matAutoComplete in angular 4.In this, I used to get data from the server.for that, I used the pipe here.

*ngFor="let c of characters | async"

But pipe gives me an error like this.

"cannot read property 'dispose' of null angular 4".

please provide me a solution.Thank you!

Upvotes: 4

Views: 8403

Answers (1)

Ahmad Sharif
Ahmad Sharif

Reputation: 4435

First of all, the type is not defined in component. Define it in the component. Like this

characters:any : Array<any> = [];

Then

<div *ngIf="characters.length > 0">
   <li *ngFor="let c of characters">
   
   </li>
</div> <!-- End -->

Upvotes: 1

Related Questions