![]() ![]() On Sat, Aug 31, 2019, 8:06 PM Layton wrote: I think the entire point of thewarning is that you're using reactive forms, and therefore should not beusing template-driven-form syntax to control form state. This could cause alot of confusion when a developer sees reactive forms, tries to program inreactive forms, and unknowingly ends up fighting a template-driven formconvention because it was implemented in conflict.-You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub,or mute the thread. The solution is to set/unset the disabled state in code just like you're handing the rest of your reactive form state ( ntrols'someControl'.disable). This could cause a lot of confusion when a developer sees reactive forms, tries to program in reactive forms, and unknowingly ends up fighting a template-driven form convention because it was implemented in conflict. ![]() I think the entire point of the warning is that you're using reactive forms, and therefore should not be using template-driven-form syntax to control form state. Might have to get creative with a timeout. I have so far downgraded the form module to 0.3.0, hoping for a PR resolving the situation above, but based on your comment, I fear this spec is not going to change, is it? Definitely doable, but it feels terribly awkward, at least compared to the current solution, don't you think?Either way, I will have to live with what is implemented. This function shall subscribe to valueChanges, and also be called when the component is loaded, or when the save method is called. This approach is quite consistent for me, ngIf like disabled are all in the html template.Now, if I have to refactor this code based on what you suggest, I will probably need a central function in my class, and call disable or enable for each field, based on the value of the form and from external property (user profile, route params, etc.). ![]() I'm playing with the disabled and ngIf attribute / directive ( required is so far always static in my case) but all are defined by, I would call that rules, at the attribute/directive level. Keywords : javascript,datetime,momentjs Read More. ![]() Keywords : Google,Cloud,Collective,google-cloud-firestore,firebase-console Read More. įirestore DB - documents shown in italics I'm aware that we can disable particular form control, for instance: fb.control(' Let's say we have myFormGroup which is initialized via FormBuilder: this.myFormGroup = this.fb.group( ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |