Created
March 20, 2018 22:09
-
-
Save AmirTugi/1a27ad79fb06e132301d4d4eadba3ae2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import {FormGroup, FormBuilder} from '@angular/forms'; | |
@Component({ | |
selector: 'my-app', | |
templateUrl: './app.component.html', | |
styleUrls: [ './app.component.scss' ] | |
}) | |
export class AppComponent implements OnInit { | |
checkoutForm: FormGroup; | |
constructor(private fb: FormBuilder) {} | |
ngOnInit() { | |
this.checkoutForm = this.fb.group({ | |
fullName: null | |
}) | |
} | |
/** | |
* After a form is initialized, we link it to our main form | |
*/ | |
formInitialized(name: string, form: FormGroup) { | |
this.checkoutForm.setControl(name, form); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment