OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Cannot read properties of undefined (reading 'filter')

  • Thread starter Thread starter Leonardo Rodrigues
  • Start date Start date
L

Leonardo Rodrigues

Guest
I'm trying to get into Angular after a few months without programming and have decided to code a cascading dropdown menu. I was trying to do the second part of the cascade and my code was looking like this:

Code:
onSelect(event_type:any){
    this.dropdownListService.getAll().subscribe((res:any)=>{
      this.properties = res['properties'].filter((res:any) => res.event_type == event_type!.value),
      console.log(this.properties);
    })
  }

The only problem is that I'm getting

"ERROR TypeError: Cannot read properties of undefined (reading 'filter')"

I can't understand, why is it undefined?

<p>I'm trying to get into Angular after a few months without programming and have decided to code a cascading dropdown menu. I was trying to do the second part of the cascade and my code was looking like this:</p>
<pre><code>onSelect(event_type:any){
this.dropdownListService.getAll().subscribe((res:any)=>{
this.properties = res['properties'].filter((res:any) => res.event_type == event_type!.value),
console.log(this.properties);
})
}
</code></pre>
<p>The only problem is that I'm getting</p>
<blockquote>
<p>"ERROR TypeError: Cannot read properties of undefined (reading 'filter')"</p>
</blockquote>
<p>I can't understand, why is it undefined?</p>
 

Latest posts

Top