Skip to content

Instantly share code, notes, and snippets.

@AmirTugi
Created March 20, 2018 22:09
Show Gist options
  • Save AmirTugi/1a27ad79fb06e132301d4d4eadba3ae2 to your computer and use it in GitHub Desktop.
Save AmirTugi/1a27ad79fb06e132301d4d4eadba3ae2 to your computer and use it in GitHub Desktop.
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