Rich
Rich

Reputation: 4248

Element Reference in Material Components only return _animationMode property

I am trying to get the properties of my HTML Element which is apparently <mat-card> tag using Angular's Element Referencing and accessing it through @ViewChild; however, I was not able to get all the properties of that element and only returned with an object that has _animationMode property only.

Here's the StackBlitz project in order for you to replicate it.

Upvotes: 0

Views: 353

Answers (1)

Allabakash
Allabakash

Reputation: 2027

Use ViewChildren as mat-card does not have nativeElement..

  @ViewChildren('customForm', { static: false, read: ElementRef }) customForm: any;

which gives you list of nativeElements. Here is the demo - https://stackblitz.com/edit/angular-x7nfau.

Hope this helps.

Upvotes: 1

Related Questions