title: Custom Component in Angular with ngModel and multiple fields
body: <p>So lets say I want a create a custom component in Angular 2+ for the following class</p>
  
  <pre><code>public class user {
      name: string;
      id: number;
      address: string;
  }
  </code></pre>
  
  <p>I've created a custom component</p>
  
  <pre><code>&lt;input [(ngModel)]="name" /&gt;
  &lt;input [(ngModel)]="id" /&gt;
  &lt;input [(ngModel)]="address" /&gt;
  </code></pre>
  
  <p>I've added this custom component into my main page </p>
  
  <pre><code>&lt;user-component&gt;&lt;/user-component&gt;
  </code></pre>
  
  <p>What I want to do now is pass the User class as ngModel inside my custom component and bind it with <code>public user:User</code> variable in my main page class. Something like this </p>
  
  <pre><code>&lt;user-component [(ngModel)]="user"&gt;&lt;/user-component&gt;
  </code></pre>
  
  <p>I've found few examples of using <code>ControlValueAccessor, NG_VALUE_ACCESSOR</code> but all these examples work with single component like one text input. Is there a way to make it work for multiple inputs inside the custom component as well?</p>