Walter White
Walter White

Reputation: 1026

Get reference to attributie inside html element

HTML

<input #autoC auto-complete [(ngModel)]="myData" [source]="mySource" />

TS

@ViewChild('autoC') auto: ElementRef;

But when i use ViewChild I have reference to input and auto-complete is attributes. Is possible get reference to auto-complete. I need this element because i want change some css style in auto-complete? Using [ngClass] also add style to input element.

This is the autocomplete package

Upvotes: 0

Views: 39

Answers (1)

Amaresh C.
Amaresh C.

Reputation: 599

Try using @ViewChild('autoC') auto: HTMLElement;. You'll get access to attributes and their get and set methods as well. Check below screenshot.

enter image description here

Upvotes: 1

Related Questions