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
form.reset() does not work as expected - issues with [(ngModel)] #50971
Comments
This is working as intended, unfortunately. In your reproduction the NgModel directive is initially bound to the value You can work around this by passing the new value to the reset call, like duplicate of #19835 |
Thanks for the reply.
|
I would say that you guys have some major issue around here. 0 ------ 0 ---- Please Choose -> this is added via code when I build the any select box options. I have a select box component that gets which brand options to display to the user and which car specific to focus on. With these parameters the select box component selects the data from the DB and displays it to the user. |
Permite emissão de evento com `(p-change-model)` após resetar formulário reativo Modificação feita por conta de um bug que impedia a emissão do evento após resetar o formulário reativo no Angular. angular/angular#54022 angular/angular#52135 angular/angular#50971 angular/angular#46458 angular/angular#15741 Fixes DTHFUI-7232
Permite emissão de evento com `(p-change-model)` após resetar formulário reativo Modificação feita por conta de um bug que impedia a emissão do evento após resetar o formulário reativo no Angular. angular/angular#54022 angular/angular#52135 angular/angular#50971 angular/angular#46458 angular/angular#15741 Fixes DTHFUI-7232
Permite emissão de evento com `(p-change-model)` após resetar formulário reativo Modificação feita por conta de um bug que impedia a emissão do evento após resetar o formulário reativo no Angular. angular/angular#54022 angular/angular#52135 angular/angular#50971 angular/angular#46458 angular/angular#15741 Fixes DTHFUI-7232
Per @garrettld's explanation. This works as designed, template-driven forms are more CD dependent that reactive forms. |
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
Yes
Description
HI
My first intention was to user form.reset() to reset touched and dirty flags on the form.
I found that it clears the variables on my ts file. I don't like it but I can leave with it.
In order to overcome this issue after form.reset() I repopulated my variables.
The new value appears on the form only if it is different than the older (before reset) one.
Here is my html file:
Here is my ts file :
Reproduction scenario:
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: