question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No hook or observable member available to get latest form value after component initialised

See original GitHub issue

There 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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:32 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
ntzioliscommented, Feb 28, 2020

@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 what formGroupValuesdoes only on formGroup level + observable which makes the name very descriptive.

1reaction
ntzioliscommented, Feb 28, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found