Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Last active February 28, 2021 15:57
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 ssougnez/af1ca0464e9c32ac0c09ba736fac93fb to your computer and use it in GitHub Desktop.
Save ssougnez/af1ca0464e9c32ac0c09ba736fac93fb to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
enum Fields {
Enabled = "enabled"
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
public form: FormGroup;
public Fields: typeof Fields = Fields;
constructor(private _fb: FormBuilder) { }
public ngOnInit() {
this.form = this._fb.group({
[Fields.Enabled]: [true]
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment