No hook or observable member available to get latest form value after component initialised
See original GitHub issueThere is currently onFormUpdate()
hook and formGroup.valuechanges
observable, but they are not called when the component gets the value from external after finish initialization.
There are indeed workarounds exist. But getting the latest form value after form initialization is still a legit scenario that is useful for this library.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:32 (14 by maintainers)
Top Results From Across the Web
async pipe sends 'null' value to the child component
null after that (e.g. first onChanges hook or onInit hook`) when no value is emitted by the Observable; value when the Observable emit...
Read more >AfterViewInit - Angular
A lifecycle hook that is called after Angular has fully initialized a component's view. Define an ngAfterViewInit() method to handle any additional ...
Read more >3 Ways to Pass Async Data to Angular 2+ Child Components
Solution 2: Use ngOnChanges ngOnChanges is a lifecycle hook that run whenever it detects changes to input properties. That means it's ...
Read more >Complete Guide: Angular lifecycle hooks - InDepth.Dev
In this article, we will take a deeper dive into each lifecycle hook and look at how they're used in Angular.
Read more >Using an NgRX Store Module in an Angular Application
It returns the Store object itself, which is an Observable, so that components can hook into the select() method in order to monitor...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@maxime1992 These two observables would work for us. in fact I like the name
writeValue$
a lot as it is super clear what it does or where it comes. Any other name I can think of right now would need a lengthy explanation of when it gets fired and why.In regards to anyformUpdate$: I would probably call it
formGroupValue$
as it resembles whatformGroupValues
does only onformGroup
level + observable which makes the name very descriptive.You are right, forgot about the remapping. Then maybe something like writeFormValue$, but I feel this is way less prescriptive than writeValue$. And you are right the typing prevents users from errors. So after thinking about it some more I’d still vote for writeValue$, but only because I cannot think of a better alternative. Damn naming is hard xD