File
Implements
Metadata
changeDetection |
ChangeDetectionStrategy.OnPush |
selector |
dynamic-form |
template |
<dynamic-form-ui
[dynamicFormConfig]="config"
[formGroup]="formGroup"
(formSubmitted)="onSubmit.emit($event)"></dynamic-form-ui>
|
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Outputs
|
|
Outputs
onSubmit
|
Type : EventEmitter<any>
|
|
import { Component, Input, Output, OnInit, EventEmitter, ChangeDetectionStrategy } from '@angular/core'
import { FormGroup } from '@angular/forms'
import { DynamicFormConfig } from '../models/dynamic-form-config.model'
import { DynamicFormService } from '../services/dynamic-form.service'
@Component({
selector: 'dynamic-form',
template: `
<dynamic-form-ui
[dynamicFormConfig]="config"
[formGroup]="formGroup"
(formSubmitted)="onSubmit.emit($event)"></dynamic-form-ui>
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DynamicFormComponent implements OnInit {
@Output()
onSubmit: EventEmitter<any> = new EventEmitter<any>()
@Input()
config: DynamicFormConfig
formGroup: FormGroup
constructor(
private dynamicFormService: DynamicFormService
) {}
ngOnInit() {
this.formGroup = this.dynamicFormService.createFormGroup(this.config.inputs)
}
}
Legend
Html element with directive