Skip to content

feat(forms): add updateOn and ngFormOptions to NgForm #18594

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

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

kara
Copy link
Contributor

@kara kara commented Aug 8, 2017

This commit introduces a new Input property called ngFormOptions to the NgForm directive. You can use it to set default updateOn values for all the form's child controls. This default will be used unless the child has already explicitly set its own updateOn value in ngModelOptions.

Potential values: change | blur | submit

<form [ngFormOptions]="{updateOn: blur}">
  <input name="one" ngModel>  <!-- will update on blur-->
</form>

For more context, see #18577.

@mary-poppins
Copy link

You can preview eddc5d7 at https://pr18594-eddc5d7.ngbuilds.io/.

@kara kara added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 9, 2017
Copy link
Contributor

@tinayuangao tinayuangao left a comment

Choose a reason for hiding this comment

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

LGTM

@kara kara added target: major This PR is targeted for the next major release and removed state: blocked labels Aug 16, 2017
@kara
Copy link
Contributor Author

kara commented Aug 16, 2017

@mhevery Can you approve the public API changes? Reviewed informally with Igor before he left, but I need the formal PR approval for the check.

@mary-poppins
Copy link

You can preview 72b504f at https://pr18594-72b504f.ngbuilds.io/.

This commit introduces a new Input property called
`ngFormOptions` to the `NgForm` directive. You can use it
to set default `updateOn` values for all the form's child
controls. This default will be used unless the child has
already explicitly set its own `updateOn` value in
`ngModelOptions`.

Potential values: `change` | `blur` | `submit`

```html
<form [ngFormOptions]="{updateOn: blur}">
  <input name="one" ngModel>  <!-- will update on blur-->
</form>
```

For more context, see [angular#18577](angular#18577).
@mary-poppins
Copy link

You can preview 6a7f8a3 at https://pr18594-6a7f8a3.ngbuilds.io/.

@kara kara added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 16, 2017
@hansl hansl merged commit 0d45828 into angular:master Aug 16, 2017
@shyamal890
Copy link

This doesn't yet support debounce ngModelOption on inputs. I would like to know what is the logic behind not implementing the same with blur?

Example usecase for debounce:

  • A text input like in Google docs which should save the typed text after 3 secs of no keypress after typing.

@angular-automatic-lock-bot
Copy link

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 Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: forms cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants