title: Angular 2 Reactive Froms - bind a whole object at once
body: <p>I'm learning reactive forms in Angular 2 and I was wondering if it was possible to bind all object properties at once. Each guide I see show something like that :</p>
  
  <pre><code>this.form = this.fb.group({
      name: ['', Validators.required],
      event: this.fb.group({
          title: ['', Validators.required],
          location: ['', Validators.required]
      })
  });
  </code></pre>
  
  <p>Then setting values like that :</p>
  
  <pre><code>this.form.setValue({
      name: object.name,
      event: object.event
  });
  </code></pre>
  
  <p>For me, this is not something doable in real situation, because you often need to bind a lot of properties and defining them is not really convenient. And if the model change, you need to update it in both place. </p>
  
  <p>So I tried this : </p>
  
  <pre><code>this.refundRecordForm = this.fb.group(new RefundRecord());
  this.refundRecordForm.setValue(this.refundRecord);
  </code></pre>
  
  <p>But I got this error :</p>
  
  <blockquote>
    <p>Error: 
            There are no form controls registered with this group yet.  If you're using ngModel,
            you may want to check next tick (e.g. use setTimeout)</p>
  </blockquote>
  
  <p>If I use <code>patchValue</code> instead of <code>setValue</code>, no errors but the form contains no controls.</p>
  
  <p>I tried binding manually a few fields and it worked so my guess is that you can't bind the whole object at once.</p>
  
  <p>So I'm wondering if it's possible. I'm very new to this so maybe I'm missing something obvious.</p>
  
  <p>What do you think ?</p>