ipsos-components
Version:
Material Design components for Angular
27 lines (23 loc) • 675 B
text/typescript
import {Component} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
/**
* @title Slide-toggle with forms
*/
({
selector: 'slide-toggle-forms-example',
templateUrl: './slide-toggle-forms-example.html',
styleUrls: ['./slide-toggle-forms-example.css'],
})
export class SlideToggleFormsExample {
isChecked = true;
formGroup: FormGroup;
constructor(formBuilder: FormBuilder) {
this.formGroup = formBuilder.group({
enableWifi: '',
acceptTerms: ['', Validators.requiredTrue]
});
}
onFormSubmit(formValue: any) {
alert(JSON.stringify(formValue, null, 2));
}
}