angular 监听一个动态表单中变量值的变化

  1. 定义表单
        this.infoForm = this.fb.group({
          type: ["TP_MERCHANT"],})
  2. 初始化时监听该数据
        this.infoForm.get('type')?.valueChanges.subscribe(value => {
        console.log('cahnges',value);
        });

猜你喜欢

转载自blog.csdn.net/2301_78916954/article/details/142784817