@ -6,7 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ElementFinder, browser, by, element} from 'protractor';
|
||||
import {browser, by, element, ElementFinder} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../test-utils';
|
||||
|
||||
describe('nestedFormGroup example', () => {
|
||||
@ -40,5 +41,4 @@ describe('nestedFormGroup example', () => {
|
||||
expect(firstInput.getAttribute('value')).toEqual('Bess');
|
||||
expect(lastInput.getAttribute('value')).toEqual('Marvin');
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {ReactiveFormsModule} from '@angular/forms';
|
||||
|
@ -37,9 +37,13 @@ export class NestedFormGroupComp {
|
||||
email: new FormControl()
|
||||
});
|
||||
|
||||
get first(): any { return this.form.get('name.first'); }
|
||||
get first(): any {
|
||||
return this.form.get('name.first');
|
||||
}
|
||||
|
||||
get name(): any { return this.form.get('name'); }
|
||||
get name(): any {
|
||||
return this.form.get('name');
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
console.log(this.first.value); // 'Nancy'
|
||||
@ -48,6 +52,8 @@ export class NestedFormGroupComp {
|
||||
console.log(this.form.status); // VALID
|
||||
}
|
||||
|
||||
setPreset() { this.name.setValue({first: 'Bess', last: 'Marvin'}); }
|
||||
setPreset() {
|
||||
this.name.setValue({first: 'Bess', last: 'Marvin'});
|
||||
}
|
||||
}
|
||||
// #enddocregion
|
||||
|
Reference in New Issue
Block a user