检查在html中修改的输入,而不使用Angular 6形式

问题描述 投票:0回答:1

如何检查输入是否在html代码中被修改,而不使用任何形式

我有下面的代码

 <textarea #txt (change)="data.url = txt.value" placeholder="https://"
 [value]="data.url" ></textarea>
  <span *ngIf="!txt.value">
   <span class="">Required</span>
 </span>
  <span *ngIf="txt && txt.dirty && !customValidationService.urlValidator(txt.value)">
    <span class="">Invalid</span>
 </span>

请帮助,谢谢

javascript angular6
1个回答
0
投票
 <textarea #txt (change)="textChange(event)" = txt.value" placeholder="https://"
 [value]="data.url" ></textarea>
  <span *ngIf="!txt.value">
   <span class="">Required</span>
 </span>
  <span *ngIf="txt && txt.dirty && !customValidationService.urlValidator(txt.value)">
    <span class="">Invalid</span>
 </span>

function textChange(event){
/* Validation code here */
}
© www.soinside.com 2019 - 2024. All rights reserved.