单击按钮时将值设置为文本区域

时间:2019-10-23 08:36:53

标签: angular typescript

没有发现错误,单击按钮时如何将值设置为文本区域?

  

默认值332,并且单击按钮时的值更改为ROUNDUP(332)

文本区域代码:

<mat-form-field appearance="outline">
   <mat-label>{{getEntityMeta('function').fieldDescription}}</mat-label>
   <textarea matInput [placeholder]="getEntityMeta('function').fieldDescription" type="text"
       name="function" [(ngModel)]="salaryformulaEntity.function" 
       #function="ngModel" [disabled]="salaryformulaEntity.isUnmodified()" [required]="getEntityMeta('function').mandatory" 
       [wynixMandatory]="getEntityMeta('function').mandatory" [wynixMaxLength]="getEntityMeta('function').maxLength"
       wynixSpecialCharacter></textarea>
   <mat-error *ngIf="getErrorMessage(function)">{{getErrorMessage(function)}}</mat-error>
   <mat-hint align="end">{{function.value?.length || 0}}/{{getEntityMeta('function').maxLength}}</mat-hint>
</mat-form-field>

按钮逻辑代码:

selectComponent(): void {
    for (let index = this.componentLov.length - 1; index >= 0; index--) {
      const component: LOVItem = this.componentLov[index];

      if (component.options.selected) {


        component.options.selected = false;
      }
    }

    this.filterComponentsLov();
    this.filterFunctionsLov();
    this.filterFormulasLov();
}

1 个答案:

答案 0 :(得分:1)

您可以在点击操作级别分配文本区域值:在按钮逻辑内添加 salalformulaEntity.function =“ newValue”