-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger displayValue without using FormControl #9
Comments
Nevermind, I think this is how Angular just works.. |
Yes, that's correct. This is just the Angular API for setting up a form control value, nothing specific to this search and select widget. |
Exactly. And since you are using ControlValueAccessor, you can just use the 2 way binding on your component/module by using the Like so:
Which is actually not explained (or I miss a demo). Maybe just once again, add an usage 👍 somewhere --> Ps. why do you not use the accessor called |
@Danger89 As you point out it is possible to use both reactive forms and template forms with ngModel, but we don't recommend that here so we definitely don't show it in any example code. (Actually, we rarely used template forms at all.) The control being bound to is not a search control, so I don't believe a |
I know you can set a new (default) value via the formControl reactive forms.
By creating a new FormControl:
And set the value via:
But since I don't want to provide any
input
element for the end-user to set a value, but rather my components knows which is the current value to set as default (retrieved from the database), I have the feeling this FormControl is overkill for me.Is there another way to trigger
displayValue(..)
without using FormControl?Thanks in advance.
Kind regards,
Melroy
The text was updated successfully, but these errors were encountered: