Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

docs: update and improve docs for input, ngModelController, and guide/forms #9620

Closed
wants to merge 6 commits into from

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Oct 14, 2014

In this PR:

  • make it more clear that you should use $validators for custom validation (updated example in guide etc)
  • adds explicit information what certain inputs require (Date object for input[date] etc)
  • update outdated information (css class list, parse errors)
  • explain how to override built-in validators (for ye olde Email regex discussion)

Feeback welcome, I probably have introduced typos and odd wordings.

- `ng-valid-[key]`: for each valid key added by `$setValidity`
- `ng-invalid-[key]`: for each invalid key added by `$setValidity`
- `ng-pristine`: the control hasn't been changed yet
- `ng-dirty`: the control has been changed
Copy link
Member

Choose a reason for hiding this comment

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

This might be slightly misleading (i.e. giving the impresssion that if the original value is restored, the control wouldn't be $dirty). Maybe "has been interacted with" ?
(Just a thought - not even sure it makes it more clear.)

@gkalpak
Copy link
Member

gkalpak commented Oct 15, 2014

@Narretz:
The lines are too long in guide/forms.ngdoc (which makes it more difficult to read, review and comment).
Since you touched this, how about fixing line lengths as well ? :)


In the following example we create two directives.
Additionally, there is the `$asyncValidators` object which handles asynchronous validation, such as making an `$http` request to the backend. Functions added to the object must return a promise that must be `resolved` when valid or rejected when `invalid`. In-progress async validations are added to `ngModelController.$pending`.
Copy link
Member

Choose a reason for hiding this comment

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

rejected when invalid <-- probably meant rejected when invalid

@gkalpak
Copy link
Member

gkalpak commented Oct 15, 2014

+1 @Narretz for a much needed docs update !

@IgorMinar
Copy link
Contributor

I read half-way through the changes and they look good. Feel free to merge when you think you are done with edits.

@IgorMinar IgorMinar added this to the 1.3.1 milestone Oct 17, 2014
@Narretz
Copy link
Contributor Author

Narretz commented Oct 17, 2014

Just merged it in. Thanks @gkalpak, @Blesh and @IgorMinar

@Narretz Narretz closed this Oct 17, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants