Я довольно новичок в Angular (8), и я пытаюсь получить длину входного значения, которое я создал в *ngFor
, например:
<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>
Как мне получить доступ к длинеpanel.title
в моем классе?
Это мой интерфейс / класс
export interface ProgressbarStepData {
// Each progressbar step is represented by an instance of this data type.
id: number; // Unique ID
title: string; // The label that is displayed as the step title.
color: string; // Hex code of the colored markings associated with this step. Only visible in Builder, not Viewer.
order: number; // Denotes which step this is (from step 1 to <number of steps>)
}
export class ProgressbarEditorComponent implements OnInit {
public panels: Array<ProgressbarStepData> = []; // One panel for each existing progressbar step
...
Что мне нужно, чтобы получить длину ввода, набираемого в данный момент?
РЕДАКТИРОВАТЬ
Чтобы прояснить, чего я хочу достичь: я хочу посчитать символы, набранные на входе CURRENT, и вызвать оповещение из класса (не из самого шаблона)