Skip to content
Permalink
Browse files

fix(forms): support dots in control names in contains (#11542)

Closes #11535
  • Loading branch information...
kara authored and evmar committed Sep 12, 2016
1 parent 220d837 commit 79055f727bae55a127a024e8750dfcee8881b889
Showing with 8 additions and 2 deletions.
  1. +1 −2 modules/@angular/forms/src/model.ts
  2. +7 −0 modules/@angular/forms/test/form_group_spec.ts
@@ -626,8 +626,7 @@ export class FormGroup extends AbstractControl {
* Check whether there is a control with the given name in the group.
*/
contains(controlName: string): boolean {
const c = StringMapWrapper.contains(this.controls, controlName);
return c && this.get(controlName).enabled;
return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
}

setValue(value: {[key: string]: any}, {onlySelf}: {onlySelf?: boolean} = {}): void {
@@ -569,6 +569,13 @@ export function main() {

expect(group.contains('optional')).toEqual(true);
});

it('should support controls with dots in their name', () => {
expect(group.contains('some.name')).toBe(false);
group.addControl('some.name', new FormControl());

expect(group.contains('some.name')).toBe(true);
});
});


0 comments on commit 79055f7

Please sign in to comment.
You can’t perform that action at this time.