Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getInitialValue() function to get the initial form value already stored in forms-manager #15

Closed
manudss opened this issue Aug 3, 2020 · 2 comments · Fixed by #16

Comments

@manudss
Copy link
Contributor

manudss commented Aug 3, 2020

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Cannot get the initial value of form. This was in private.

Expected behavior

We would like to be able to obtain the initial value of the form. This value has been saved by the plug-in for the isDirty function.
It is not possible to retrieve this value, as it is in private property. There is a method called setInitialValue(). It would be useful to have a method: getInitialValue().

/**
*

  • Get the initial value for a control
  • @example
  • manager.getInitialValue('login');

*/
getInitialValue(name: keyof FormsState): any {
return this.initialValues$$.get(name);
}

What is the motivation / use case for changing the behavior?

In our case, we would need to retrieve the initial value of the form, in order to make calculations afterwards to calculate the differences and track all the changes that have been made. And, like, we would use this plug-in that would store the initial state. It would be a shame to have to store this state somewhere else, when it's already stored in form-manager, and we could just retrieve it here.

Is it ok for you to make a pull request to add this feature to the plug-in?

@NetanelBasal
Copy link
Member

Yes

manudss added a commit to manudss/forms-manager that referenced this issue Aug 3, 2020
To be able to obtain the initial value of the form.

Closes ngneat#15
manudss added a commit to manudss/forms-manager that referenced this issue Aug 3, 2020
To be able to obtain the initial value of the form.

Closes ngneat#15
@marleypowell
Copy link

Is there a way that I can use this feature or is there a new package version that will be released soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants