Search code examples
javascriptangular2-formsngrx-store

How do I change the value of an input field in angular using ngrx/store


I have a backgroundHex key/value in my ngrx/store for my colors object. So to access it in my app I would do the following {{(colors | async).backgroundHex)}}

The above works quite well, but when it comes to input fields I've been having a hard time finding the right syntax in a timely fashion and I was wondering if someone could help. I've tried value, ngModel, and ngModelChanged(perhaps not in the right way).

Any help would be incredibly helpful. Thank you.


Solution

  • It turns out that it is really simple. Assuming you have the store properly hooked up into the component, the following is will work:

    value="{{(colors | async).backgroundRed}}"