Commit Graph

162 Commits

Author SHA1 Message Date
gary-b 821b8f09d6 fix(forms): ensure select[multiple] retains selections
If you bound an array to select[multiple] via ngModel and subsequently
changed the options to select from, the UI would drop any selections
made since by the user. This was due to
SelectMultipleControlValueAccessor not keeping a reference to the new
model arrays it generated when users interacted with the select control.
Update code to keep the reference.

Closes #12527
Closes #12654
2016-12-14 08:52:07 -08:00
Dzmitry Shylovich 2bf1bbc071 fix(forms): introduce checkbox required validator
Closes #11459
Closes #13364
2016-12-14 08:44:24 -08:00
gary-b 7b0a86718c fix (forms): clear selected options when model is not an array (#12519)
When an invalid model value (eg empty string) was preset ngModel on
select[multiple] would throw an error, which is inconsistent with how it
works on other user input elements. Setting the model value to null or
undefined would also have no effect on what was already selected in the
UI. Fix this by clearing selected options when model set to null,
undefined or a type other than Array.

Closes #11926
2016-12-14 08:34:19 -08:00
Dzmitry Shylovich 4c35be3e07 feat(forms): add novalidate by default (#13092) 2016-12-12 11:17:42 -08:00
Dzmitry Shylovich e9f307f948 fix(forms): fix Validators.min/maxLength with FormArray (#13095)
Fixes #13089
2016-12-12 11:17:12 -08:00
Miško Hevery 16efb13dd1 fix: display framework version on bootstrapped component (#13252) 2016-12-06 16:21:07 -08:00
Victor Savkin e628b66cca feat(build): record angular version in the dom (#13164) 2016-11-30 13:52:08 -08:00
Alex Eagle 664a6273e1 feature(tsc-wrapped): add option for closure compiler JSDoc annotations 2016-11-18 09:37:40 -08:00
Dzmitry Shylovich f79b320fc4 refactor(forms): remove facade (#12558) 2016-11-15 18:48:34 -08:00
Dzmitry Shylovich 46023e4792 fix(select): allow for null values in HTML select options bound with ngValue
closes #12829
2016-11-14 16:47:14 -08:00
Craig Hutchison b55aaf094f fix: allow for null values in HTML select options bound with ngValue
This corrects the case of <option [ngValue]="null"> binding a string like "{0: null}" to the model instead of an actual null object.

Closes #10349
2016-11-14 16:47:09 -08:00
Craig Hutchison d90b622fa4 fix: allow for null values in HTML select options bound with ngValue
This corrects the case of <option [ngValue]="null"> binding a string like "{0: null}" to the model instead of an actual null object.

Closes #10349
2016-11-14 16:47:09 -08:00
Victor Berchet 79e2bb9291 refactor(core): remove dead code (#12871) 2016-11-14 16:44:25 -08:00
Joao Dias 77ee27c59e refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
Tobias Bosch 69dfcf7385 docs(forms): add inline docs why `ngModel` runs a 2nd change detection run (#12821)
Related to #11895
2016-11-11 15:24:11 -08:00
Victor Berchet 45ddd6ba78 cleanup(forms): remove facade (#12804) 2016-11-11 10:47:34 -08:00
Victor Berchet ef881475e9 fix(forms): check if registerOnValidatorChange exists on validator before trying to invoke it (#12801)
closes #12593
2016-11-10 16:20:59 -08:00
Dzmitry Shylovich 09092ac3c2 fix(forms): getRawValue returns any instead of Object (#12599) 2016-11-08 15:44:36 -08:00
Victor Berchet ec92f4b198 refactor: remove `keys()` and `values()` from MapWrapper 2016-11-04 13:27:38 -07:00
Justin James 2b5c983c13 docs(reset): change semi-colon to colon in code example
The first code example for the reset function was invalid as it has a semi-colon instead of a colon for the last property in the json object.  Change the semi-colon to a colon.

Closes https://github.com/angular/angular/issues/12531
2016-10-26 14:56:57 -07:00
Victor Berchet 57051f01ce refactor: remove most facades (#12399) 2016-10-21 15:14:44 -07:00
Victor Berchet 76dd026447 refactor: remove some facades (#12335) 2016-10-19 13:42:39 -07:00
shaul almog 0e9503b500 feat(forms) range values need to be numbers instead of strings (#11792) 2016-10-19 10:12:13 -07:00
Pawel Kozlowski 97bc97153b feat(forms): add ng-pending CSS class during async validation (#11243)
Closes #10336
2016-10-19 09:56:31 -07:00
Dzmitry Shylovich 445e5922ec feat(forms): make 'parent' a public property of 'AbstractControl' (#11855) 2016-10-19 09:55:50 -07:00
Florian Kinder b9fc090143 feat(forms): Added emitEvent to AbstractControl methods (#11949)
* feat(forms): Added emitEvent to AbstractControl methods

* style(forms): unified named parameter
2016-10-19 09:54:54 -07:00
Cédric Exbrayat 592f40aa9c feat(forms): add hasError and getError to AbstractControlDirective (#11985)
Allows cleaner expressions in template-driven forms.

Before:

    <label>Username</label><input name="username" ngModel required #username="ngModel">
    <div *ngIf="username.dirty && username.control.hasError('required')">Username is required</div>

After:

    <label>Username</label><input name="username" ngModel required #username="ngModel">
    <div *ngIf="username.dirty && username.hasError('required')">Username is required</div>

Fixes #7255
2016-10-19 09:49:02 -07:00
Dzmitry Shylovich bf60418fdc feat(forms): Validator.pattern accepts a RegExp (#12323) 2016-10-19 09:37:54 -07:00
Florian Kinder 15fc5dd7ee test(forms): added missing selfOnly tests (#12317) 2016-10-17 22:51:13 -07:00
Connor Wyatt 17e3410d98 Form submit event (#11989)
* feat(forms): ngSubmit event exposes $event from original submit event as local variable

Modify NgForm directive and FormGroup directive to expose the original submit event as $event in the ngSubmit event. Modify docs to reflect changes.

This resolves #10920.

* refactor: code cleanup
2016-10-11 15:49:36 -07:00
Victor Berchet d972d82354 refactor: simplify `isPresent(x) ? x : y` to `x || y` (#12166)
Closes #12166
2016-10-10 09:20:58 -07:00
Pawel Kozlowski d22eeb70b8 fix(forms): allow optional fields with pattern and minlength validators (#12147) 2016-10-10 09:17:45 -07:00
Pawel Kozlowski f50c1da4e2 fix(forms): properly validate blank strings with minlength (#12091) 2016-10-06 15:12:09 -07:00
Alex Eagle 8c975ed156 refactor(facade): inline StringWrapper (#12051) 2016-10-06 15:10:27 -07:00
Victor Berchet cf269d9ff4 refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
Pawel Kozlowski 4a57dcfd8d fix(forms): properly validate empty strings with patterns (#11450) 2016-10-04 16:14:23 -07:00
Victor Berchet 50c37d45dc refactor: simplify arrow functions (#12057) 2016-10-04 15:57:37 -07:00
Chuck Jazdzewski 43d3a84df3 Revert "refactor: add license header to JS files & format files (#12035)"
This reverts commit 8310c91823.
2016-10-04 14:06:41 -07:00
Victor Berchet 8310c91823 refactor: add license header to JS files & format files (#12035) 2016-10-04 13:15:49 -07:00
Alex Eagle b64b5ece65 refactor(facade): Remove most of StringMapWrapper facade. (#12022)
This change mostly automated by
12012b07a2
with some manual fixes.
2016-10-03 16:46:05 -07:00
Alex Eagle 0286956107 refactor(facade): Inline isBlank called with object-type argument (#11992) 2016-09-30 09:26:53 -07:00
Florian Kinder 36bc2ff269 docs(forms): Added FormControl initialization information (#11948) 2016-09-28 13:59:08 -07:00
Alex Eagle 41c8c30973 chore(lint): remove unused imports (#11923)
This was done automatically by tslint, which can now fix issues it finds.
The fixer is still pending in PR https://github.com/palantir/tslint/pull/1568
Also I have a local bugfix for https://github.com/palantir/tslint/issues/1569
which causes too many imports to be deleted.
2016-09-27 17:12:25 -07:00
Victor Berchet 58605cf350 refactor(facade): remove useless facades 2016-09-27 16:13:09 -07:00
Victor Berchet 33340dbbd1 docs: remove outdated docs (#11875) 2016-09-24 08:23:28 +09:00
Kara Erickson 212f8dbde7 fix(forms): disable all radios with disable() 2016-09-20 15:00:12 -07:00
Kara 44da4984f9 fix(forms): support unbound disabled in ngModel (#11736) 2016-09-20 14:55:47 -07:00
Victor Berchet 671f73448c refactor: misc cleanup (#11654) 2016-09-19 17:15:57 -07:00
Kara 51d73d3e4e fix(forms): make setDisabledState optional for reactive form directives (#11731)
Closes #11719
2016-09-19 16:26:33 -07:00
Kara bf81b06a28 docs(forms): add select control examples (#11728) 2016-09-19 16:25:33 -07:00