title: Angular Ngrx Store and two-way data binding
body: <p>I'm learning how to use the ngrx/store library in Angular 5 and I noticed an unexpected behavior... Please, help me understand if this is the default behavior for this library, because I really wasn't expecting this at all...</p>
  
  <p>Well, my objective is to create a singleton store for storing application config and multiple states for all my components, so when a component updates the store, all subscribed components receives the updated store.</p>
  
  <p>In one of my components I'm using the following constructor:</p>
  
  <pre><code>newItems: any
  
  constructor (
  private _store: Store&lt;State&gt;
  ) {
  
  _store.select('operations').subscribe(state =&gt; {
    console.log(state)
    this.newItems = state.newItems
  })
  
  }
  </code></pre>
  
  <p>So I grab the current state of my store and set "this.newItems" variable to "state.newItems". I have some inputs in my template binded with some properties of "newItems", like this:</p>
  
  <pre><code>itemProperties: any = [
  {
    name: 'Description',
    key: 'desc'
  },
  {
    name: 'Manufacturer',
    key: 'manufacturer'
  },
  {
    name: 'Model',
    key: 'model'
  },
  {
    name: 'Observation',
    key: 'genObs'
  }
  ]
  
  &lt;div *ngFor="let prop of itemProperties" class="gen-label-input" [ngClass]="{'filled': newItems[prop.key]}"&gt;
      &lt;label&gt;{{prop.name}}&lt;/label&gt;
      &lt;input [(ngModel)]="newItems[prop.key]"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I was expecting to need to dispatch an action in my component to actually modify my store, but it seems that the two-way data binding through [(ngModel)] is doing this automatically, without the need of any actions at all! I just modify my input and my store is updated, and the updated version is automagically available through my entire application.</p>
  
  <p>Is this the expected behavior of ngrx/store when I assing one store property to a component variable and combine it with [(ngModel)]?</p>
  
  <p>If yes, this is really good in some cases, as I don't have to create inumerous actions to modify my store properties. But I'm worried this is some kind of error that I'm not being able to identify.</p>
  
  <p>Thanks in advance!</p>