我对 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 输入中键入的字符数并触发来自类的警报(而不是来自模板本身)
忽然笑
开满天机
达令说
相关分类