How to set value to form control in Reactive Forms in Angular

前端 未结 6 1374
广开言路
广开言路 2020-11-28 08:15

Hi Everyone I\'m new to angular. Actually, I\'m trying to subscribe data from a service and that data, I\'m passing to form control of mine from (example, it\'s like an edit

6条回答
  •  攒了一身酷
    2020-11-28 08:37

    To assign value to a single Form control/individually, I propose to use setValue in the following way:

    this.editqueForm.get('user').setValue(this.question.user);
    
    this.editqueForm.get('questioning').setValue(this.question.questioning);
    

提交回复
热议问题