Skip to content

feat(forms): introduce initialValue to AbstractControl - #20214

Closed
Toxicable wants to merge 1 commit into
angular:masterfrom
Toxicable:forms-original-value
Closed

feat(forms): introduce initialValue to AbstractControl#20214
Toxicable wants to merge 1 commit into
angular:masterfrom
Toxicable:forms-original-value

Conversation

@Toxicable

@Toxicable Toxicable commented Nov 6, 2017

Copy link
Copy Markdown

closes #19747
adds initialValue as a readonly property on AbstractControl which holds the value passed during construction and is never change except on calling reset

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Feature

What is the current behavior?

There is no simple way to save a forms inital/original value/state
Issue Number: #19747

What is the new behavior?

a new property that stores the orginal value

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@Toxicable
Toxicable force-pushed the forms-original-value branch from 47b0759 to a6ed9a2 Compare November 6, 2017 10:39
@vicb vicb added area: forms action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 6, 2017

@benedikt-roth benedikt-roth left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, @Toxicable! Just small remarks.

Comment thread packages/forms/src/model.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: one empty line too much.

Comment thread packages/forms/src/model.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original is quite a generic name. I believe e.g. originalValue would be more explicit.
Since it is a public attribute, naming matters.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point +1

Comment thread packages/forms/test/form_array_spec.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"should" - same applies for the tests cases below.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"should" - same applies for the tests cases below.

Comment thread packages/forms/test/form_group_spec.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"should" - same applies for the tests cases below.

@Toxicable
Toxicable force-pushed the forms-original-value branch 4 times, most recently from 32d8ff6 to eb62a1e Compare November 7, 2017 07:18

@benedikt-roth benedikt-roth left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Toxicable
Toxicable force-pushed the forms-original-value branch from eb62a1e to df964af Compare November 7, 2017 08:15
@Toxicable Toxicable changed the title feat(forms): introduce original value feat(forms): introduce initialValue to AbstractControl Nov 9, 2017
@Toxicable

Copy link
Copy Markdown
Author

I think initialValue is more appropriate then originalValue for this feature

closes angular#19747
adds `initialValue` as a readonly property on `AbstractControl` which holds the value passed during construction and is never change except on calling `reset`
@Toxicable
Toxicable force-pushed the forms-original-value branch from df964af to 7a35805 Compare November 9, 2017 00:38
@ngbot

ngbot Bot commented Jan 16, 2018

Copy link
Copy Markdown

Hello? Don't want to hassle you. Sure you're busy. But this PR has some merge conflicts that you probably ought to resolve.
That is... if you want it to be merged someday...

1 similar comment
@ngbot

ngbot Bot commented Jan 16, 2018

Copy link
Copy Markdown

Hello? Don't want to hassle you. Sure you're busy. But this PR has some merge conflicts that you probably ought to resolve.
That is... if you want it to be merged someday...

@kara kara added the feature Label used to distinguish feature request from other issues label Sep 18, 2018
@amoscatelli

Copy link
Copy Markdown

Any update ?

@jasonaden jasonaden added this to the needsTriage milestone Jan 29, 2019
@blemaire blemaire mentioned this pull request Jun 13, 2019
14 tasks
@AndrewKushnir AndrewKushnir added the forms: Controls API Issues related to AbstractControl, FormControl, FormGroup, FormArray. label May 8, 2020
@pullapprove
pullapprove Bot requested a review from AndrewKushnir May 8, 2020 23:26
@jessicajaniuk

Copy link
Copy Markdown
Contributor

We're going to close this PR since it's out of date, but the issue remains open and is still being discussed.

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: forms cla: yes feature Label used to distinguish feature request from other issues forms: Controls API Issues related to AbstractControl, FormControl, FormGroup, FormArray.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Initial / Original value API for AbstractControl

10 participants