Skip to content

Instantly share code, notes, and snippets.

@AmirTugi
Last active March 20, 2018 22:05
Show Gist options
  • Save AmirTugi/6e79212865fd94ce9bc6a865009f3ef5 to your computer and use it in GitHub Desktop.
Save AmirTugi/6e79212865fd94ce9bc6a865009f3ef5 to your computer and use it in GitHub Desktop.
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