Skip to content

Instantly share code, notes, and snippets.

@whisher
Last active June 8, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whisher/2c64aa521dd40dffe5c7e2cc10e2d377 to your computer and use it in GitHub Desktop.
Save whisher/2c64aa521dd40dffe5c7e2cc10e2d377 to your computer and use it in GitHub Desktop.
@Input() error!: Required<ErrorDto> | null;
@Input() loading!: boolean;
@Input() data!: UserDto;
@Output() submitted = new EventEmitter<UserDto>();
frm!: FormGroup;
ngOnInit(){
this.createForm();
if (this.data.userId) {
this.frm.setValue(this.data);
}
}
createForm() {
this.frm = this.fb.group({
/* Start hidden */
userId: [null],
/* End hidden */
firstName: ['', Validators.required],
lastName: ['', Validators.required]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment