Skip to content

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

Merged
hansl merged 1 commit into
angular:masterfrom
kara:ngFormOptions
Aug 16, 2017
Merged

hansl merged 1 commit into
angular:masterfrom
kara:ngFormOptions

Conversation

@kara

@kara kara commented Aug 8, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@tinayuangao tinayuangao left a comment

Copy link
Copy Markdown
Contributor

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

kara commented Aug 16, 2017 •

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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