Last active
March 20, 2018 22:05
-
-
Save AmirTugi/6e79212865fd94ce9bc6a865009f3ef5 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, Output, EventEmitter, OnInit } from '@angular/core'; | |
import { FormGroup, FormBuilder } from '@angular/forms'; | |
@Component({ | |
selector: 'shipping-form', | |
templateUrl: './shipping.component.html', | |
styleUrls: [ './shipping.component.scss' ] | |
}) | |
export class ShippingFormComponent { | |
@Output() formReady = new EventEmitter<FormGroup>() | |
shippingForm: FormGroup; | |
constructor(private fb: FormBuilder) {} | |
ngOnInit() { | |
this.shippingForm = this.fb.group({ | |
country: null, | |
city: null, | |
address: null, | |
zip: null | |
}); | |
// Emit the form group to the father to do whatever it wishes | |
this.formReady.emit(this.shippingForm); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment