在 Angular2 中通过 formBuilder 创建表单时如何访问 formControl

How to access formControl when creating a form via formBuilder in Angular2

我有以下代码

ngOnInit() {

  this.contactsService.getContactByAuthId(this.user.id).subscribe(profile => {
    this.profile = profile;
    this.profileForm = this.formBuilder.group({
      name: [this.profile.name, Validators.compose([Validators.minLength(6), Validators.required])],
      title: [this.profile.title, Validators.compose([Validators.minLength(6), Validators.required])],
      });

    this.profileForm.title.valueChanges.subscribe(value => {
        console.log(value);
        });

  });
}

我想订阅 titlevalueChanges,但我收到 Cannot read property 'valueChanges' of undefined 错误。

我可以订阅 this.profileForm.valueChanges,但我想在标题更改时进行某种去抖动和 api 调用。

似乎如果您有 FormControl,您将能够订阅它的更改,但由于我使用 FormBuilder 语法,我无法访问 FormControl

this.profileForm.get('title').valueChanges...