FabianGosebrink / ngrx-signal-store-todo

8 stars 1 forks source link

Computed values for form inputs #3

Open cheikhnadiouf opened 1 month ago

cheikhnadiouf commented 1 month ago

In this reactive form with a Todo example, why should i have to call for some computed functions .value() | .done() instead of default variables .value | .done to make it work ?

this.form = this.formBuilder.group({
      value:  new FormControl( this.store.currentTodo.value(), [Validators.required]),
      done: new FormControl( this.store.currentTodo.done(), []),
    });
export const initialState: TodoState = {
  currentTodo: {
    value: 'task1',
    done: false
  },
FabianGosebrink commented 1 month ago

Your state are signals. To unbox the value, you need to call them.