Code Monkey home page Code Monkey logo

Comments (4)

NechiK avatar NechiK commented on June 4, 2024 1

@timdeschryver Thanks for the answer. I saw that people suggest using setTimeout. For me, it is the last resort; however, it can be useful in many cases. If you know what you do and don't add it everywhere.
My first team lead liked to joke that setTimeout = 0 resolves 90% issues and setTimeout = 100 - 99%. 😆

from timdeschryver.dev.

NechiK avatar NechiK commented on June 4, 2024

Thanks for such informative article.

I've one problem with tempalte-driven forms. We have a very big form with dynamic fields. So, tempalte-driven forms looks very useful here, since we don't need to add/remove validations manually. Because we've many toggles which can show or hide fields.

The whole form was split by sections. And I need to show some markers near each section when it's valid or not. However, it's very hard to get access to nested form controls. I've tried to get acees to NgModelGroup inside each section, but on ngAfterViewInit form control is not available.

Maybe you had such situations and could help with that? Currently I see a few solutions - use reactive forms, but it would require manually clear validations and fields. Or try to put the whole form into one component, but I'm not sure that it's really change anything.

from timdeschryver.dev.

NechiK avatar NechiK commented on June 4, 2024

Regarding my previous question. I found one more workaround. Subscribe on form valueChanges and as soon we get needed field there, we can get control by name and switch stream to its statusChange.

from timdeschryver.dev.

timdeschryver avatar timdeschryver commented on June 4, 2024

Hey @NechiK , yes I do find this one of the quirks.
In those cases, I usually subscribe on form value changes (as you mentioned).
Or you can also set a setTimeout in the AfterOnInit, that way the formgroup exists.

from timdeschryver.dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.