I am a beginner in Angular (8) and I am trying to determine the length of the input value that I have created using a *ngFor
loop as shown below:
<div *ngFor="let panel of panels; index as i" class="panel" [id]="'panel-' + panel.id">
<div>{{ panel.title }}</div>
<input matInput placeholder="Bezeichnung" [(ngModel)]="panel.title" />
</div>
How can I access the character length of the panel.title
from my component?
This is my interface/class structure:
export interface ProgressbarStepData {
id: number;
title: string;
color: string;
order: number;
}
export class ProgressbarEditorComponent implements OnInit {
public panels: Array<ProgressbarStepData> = [];
...
What do I need to do in order to get the character length of the input currently being typed in?
EDIT
To clarify, I want to be able to count the characters being typed in the current input field and trigger an alert from within the component, not directly from the template.