How do I set a control value programatically when they're in a group?

Oh that's right, it's not said, because Angular docs is equally useful as a bunch of shitstains

  • 0
    ERRATUM: sorry, there's a one-liner (unmissable /s) for this very common use case saying that you can only set up all the values at the same time.

    So convenient
  • 1
    Look down, there is a part called "Dynamic Forms". You can get a control with the .get method, if its nested you can even use something like "address.bla" to move through various groups.
    There is even an entire section called "Building dynamic forms". You'll find everything you need there.
  • 1
    @Marl3x yeah, thanks for trying to help. I know I'll always find a solution but I just need to evacuate my frustration.
  • 0

    And of course this shit doesn't work with Angular Material Why would it?
  • 0

    As you can see in the documentation, FormGroup contains the FormControls, any of which has its setValue method, as written in the docs: https://angular.io/api/forms/...
  • 0
    I'm just sick of getting those gotcha every 5 fucking minutes. Angular is such a piece of garbage. They're doing everything, but badly. The docs isn't ergonomics at all, doing anything takes 10 hours of fine-grain bullshit.
  • 1
    Oh but sure setting something programmatically (which I'm forced to do because this Angular Material piece of crap isn't even designed to work with the framework it's built on) doesn't set touched or pristine accordingly.

    FFS I need another fucking job.


    Oh of course I could just set touched to true.

    It works, but Typescript complains it shouldn't so it won't compile in production. Garbage, garbage and more garbage.
  • 1
    I agree so much... The docs sucks, cover few basic use cases and all you can do is look for some shitty medium posts. And I always think "how on Earth these people managed to figure out all this stuff??"

    Either they read the whole source code or just by sorcery.
  • 0
    @dmonkey I'm always bewildered by such comments, did you read the same docs as me? I learned everything by myself, using the docs and never had a problem. Everything you need to know is there. The medium articles I've read were either reinstatements of the docs or higher concepts that no beginner needs to know.
  • 1
    @Marl3x If you say so I'll dig deeper, but e.g. some weeks ago I couldn't find any bloody doc page that explained the Control Value Accessor interface and how to build a custom form and I had to search on Fucking Medium. That's just one case...

    Maybe I'm not patient enough, I don't know...
  • 0
    @dmonkey Ok, the ControlValueAccessor really is an exception. There is an example in the api reference, but that's it. That's something pretty basic that lacks documentation, you're right.
  • 1
    If you'd actually read the docs you would have seen patch and setvalue.

    You should probably switch to react or vue where there's more training wheels and less expectation that you know anything about computer science and commonly used patterns .
  • 0
    @SortOfTested commonly used pattern by people by people who need to justify their terrible velocity and their billions spent in huge teams to their shitty corporations yeah
  • 0
    I mean how dare I expect my tool to be easy to use?
  • 0
    @Marl3x it's not an exception, it happens to me every fucking week. Everyweek I have a cornercase that isn't covered by the doc and have to dive into the framework code itself to figure out what the fuck's going on
  • 0
    @SortOfTested you wouldn't need coMmonLy UsEd SoluTioNs if your tool was well-designed in the first place.
  • 0
    @SortOfTested I bet you're the kind of engineer that blame the user his own terrible choices lmao
  • -1
    @SortOfTested seriously go back doing cobol grandpa
  • 1
    Better old and skilled than an entitled invalid who expects to be spoon-fed their job.

    Angular is utterly trivial. There's a hundred pages of docs to competency total. They even laid it out sequentially for you. But hey, I understand, that 5 or so hours of effort is a bridge too far. I mean, you literally didn't even read the first word of the docs you're whinging about:


    That means it's the reactive functional programming paradigm ( https://lmgtfy.com//... ), and that pattern organically explains every other facet of its implementation. "How to set value" would be obvious if you would have gone over that fundamental piece of how the entire framework works. It is in fact so fundamental, it's section 3 of the "Fundamentals" cateogory on the doc site. Assuming you don't quit tomorrow, you would do well to read it.

    There *is* another forms model in angular that lets you read and write from single points of data like you're used to. You would have even seen it if you would have read the Fundamentals section 2.

    But hey, who wants to exercise an ounce of introspection and say, "huh, I wonder if there's something I'm missing," when you can jump to "it's the hundreds of thousands of people who use the framework every day who are idiots because I shouldn't have to apply neurons to this thing someone is paying me an obscene amount of money to know" and then proceed to casually indict a truly talented team of individuals and an entire industry's worth of experience and accumulated problem domain knowledge.

    All because someone had the audacity to raise the bar on you. The fucking absolute gall, why can't anyone simply understand your first world problems? I ask you, has anyone ever been so put upon as this?!
  • 0
    @SortOfTested people are paying an absurd amount of money because they're convinced by people like you that simple stuff are over-complicated yeah.

    There's a direct financial interest from engineers to over-engineer stuff even when it's unwarranted and Angular is the best example of that.
  • 1
    @SortOfTested *drops the mic*
  • 0
    @SortOfTested now being serious, angular docs are a blessing if you compre it to some weird ass technologies going around, and even cobol dialects are better documented that most current frameworks lol.
  • 0
    @ostream mmmmmm I'm not convinced. Angular is not overengineered, it is just "strict".
    Someone here once said (more or less):

    Java : Javascript = Angular : react

    From my small point of view nothing could be closer to the truth. Angular compared to other frameworks forces you to take time to order your code, as java does.
    Js and react don't force the person, it is up to the developer (and could easily bring ti chaos).

    Despite the fact that I'm having a lot of trouble with Angular (and the docs, even though SortOfTested and Marl3x made me think that *maybe* -meaning "absolutely"- have to dig deeper) I can see that it holds a great potential and stability once you understand it.

    Again, I'm still having a lot of trouble with it, here's my 2 cents.
  • 0
    Ah yes forcing developers into solutions that aren't adapted to their problem is way better than leaving them architecture stuff themselves.

    Oh, what a surprise, this morning I got another fucking stacktrace from hell wilth zero indication of what the fuck he's complaining about. How fucking hard is it to check your input -_-
  • 0
    Oh wait I restarted the CLI and the error is gone. Fucking pathetic piece of crap.
  • 0
    > Angular is utterly trivial.

    > There's a hundred pages of docs to competency total.

    Pick one
  • 0
    Also I saw some messed up React codebase but I also saw some really organized and easy to navigate in ones. On the other hand, Angular ALWAYS have a heavy cognitive load as you constantly have to navigate through a hundred pages or files of bullshit to do the simplest thing. Even the bad React code is easier to follow.

    ReAcTivE ProgrAmmInG aka how to solve problem that doesn't exist in the name of intellectual purity.
  • 0
    Angular: hey something's undefined. Where? I won't tell you, go fuck yourself.
  • 0

    Hey look at this shit. Angular can't even respect the standard of the language it's written in lmao
Add Comment