title: How to set dynamic value to formControl in angular 7
body: <p>I have a drag-and-drop <code>formBuilder</code> we can able to create form using drag and drop so now i am facing problem i have hidden field in html which is <code>TempleteJson</code>.</p>
  <p>Here is html code</p>
  <pre class="lang-html prettyprint-override"><code>&lt;form [formGroup]=&quot;userForm&quot; (ngSubmit)=&quot;onSubmit()&quot;&gt;
     &lt;div class=&quot;form-group&quot;&gt;
       &lt;label&gt;Form Name:&lt;/label&gt;
       &lt;input type=&quot;text&quot; class=&quot;form-group&quot; formControlName=&quot;TemplateName&quot; /&gt;
     &lt;/div&gt;
     &lt;div class=&quot;form-group&quot;&gt;
       &lt;input type=&quot;hidden&quot; class=&quot;form-group&quot; formControlName=&quot;TemplateJson&quot; /&gt;
     &lt;/div&gt;
     &lt;div class=&quot;form-group&quot;&gt;
       &lt;label&gt;CreatedOn:&lt;/label&gt;
       &lt;input type=&quot;date&quot; class=&quot;form-group&quot; formControlName=&quot;CreatedOn&quot; /&gt;
     &lt;/div&gt;
     &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Here is component.ts file</p>
  <pre class="lang-js prettyprint-override"><code>formBuilder: any;
  formData: any;
  data: any;
  
  ngOnInit() {
      var id = this.route.snapshot.paramMap.get('id');
      
      this.dataService.GetFormById(+id).subscribe(response =&gt; {
          this.data = response['TemplateJson'];
          this.generateForm();
      },
          err =&gt; {
              this.generateForm();
      });
      
      initJq();
  }
  
  userForm = new FormGroup({
      TemplateName: new FormControl(),
      TemplateJson: new FormControl(),
      CreatedOn: new FormControl(),
  });
  
  onSubmit() {
      console.log(this.userForm.value);
      this.dataService.addFormTemplate(this.userForm.value);
  }
  </code></pre>
  <p>Now in this.data i have json and that json i want to set in TemplateJson FormControl so how can i do it .</p>
  <p>Thank you!</p>