You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom input-container component which implements error class toggling in a similar way that the material form field component does -- by accessing a directive attached to the input inside, which in turn gets the error state from NgControl.
I wanted to do a similar thing for ngrx-forms via the NgrxFormControlDirective but the state and stateSubject properties and the state$ getter are both private, meaning I can't get the state of the input from the container component.
Is there a workaround for this? Or do I have to add an input to my input directive taking the form control state object and use that instead?
The text was updated successfully, but these errors were encountered:
@nathanmarks I'll add an item to my TODO list to make the state property public. In the meantime there's two ways you can do this:
simply access the state property by casting the directive to any after injecting it (private doesn't exist at runtime so you can still access the value)
add an @Input() ngrxFormControlState binding to your own component (this will always get the same value as the ngrx-forms directive has)
@nathanmarks With a recent bugfix I made the state property public (see 8cc65d7). Once the next version is released (which should happen either this or next weekend) you'll have access to the state without the casting trick.
I have a custom input-container component which implements error class toggling in a similar way that the material form field component does -- by accessing a directive attached to the input inside, which in turn gets the error state from
NgControl
.I wanted to do a similar thing for ngrx-forms via the
NgrxFormControlDirective
but the state and stateSubject properties and the state$ getter are both private, meaning I can't get the state of the input from the container component.Is there a workaround for this? Or do I have to add an input to my input directive taking the form control state object and use that instead?
The text was updated successfully, but these errors were encountered: