反应形式:为HTML中的另一个控件设置值

时间:2018-10-30 08:31:25

标签: angular

这是我的控制权

  <mat-form-field class="example-full-width">
            <input type="text" placeholder="Role Name" aria-label="Number" matInput formControlName="rolename" [matAutocomplete]="rolename" >
            <mat-autocomplete #rolename="matAutocomplete">
              <mat-option *ngFor="let option of roleAllList" [value]="option.roleName" [attr.roleId]="option.roleId" [attr.roleDesc]="option.roleDescription" (onSelectionChange)="populateRoleDesc(option.roleDescription)">
                {{option.roleName}}
              </mat-option>
            </mat-autocomplete>
          </mat-form-field>

在此函数populateRoleDesc中,I m receiving the value of roleDescription and setting to another control, rather than using a function for is it possible to set it in HTML itself, I m使用反应形式

this.form = this.formBuilder.group({
          clientid: ['', Validators.required],
          role: ['', Validators.required],
}); 

请告诉我是否有办法。

0 个答案:

没有答案