动态设置重复输入文本字段值的角度形式?

问题描述

我正在使用角度形式重复控件。

component.ts文件

this.fields = [
      {
        key: 'allEmployeeData',type: 'repeat',fieldArray: {
          fieldGroupClassName: 'row',templateOptions: {
            btnText: 'Add more',},fieldGroup: [
            {
              fieldGroup: [
                {
                  type: 'input',key: 'empId',templateOptions: {

                    required: true,keyup: (field,$event) => {
                      console.log(field.form.controls.empId.value);
                      let empId = field.form.controls.empId.value;
                      this.fetchEmpName(empId);
                      // debugger;
                    }

                  },]
            },//Row 1 settings
            {
              fieldGroup: [
                {
                  type: 'input',key: 'empName',$event) => {
                      console.log(field.form.controls.empName.value);
                      // debugger;
                    }

                  }
                },//Row 2 settings
          ],];

在这里,当用户输入empID时,我需要在另一个重复控件(empName)中填充用户名

这是我的服务(在keyup事件上调用方法

 fetchEmpName(empId) {
    debugger;
    this.manageUseRSService.fetchUserName(empId).subscribe(data => {

   //  this.form.get('formly_6_input_empName_0').setValue("ss");
// how to set the value of emp name repeating textBox
  
    });
  }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)