@codeforges/ng-forms
Version:
Angular 4+ Dynamic form builder, decorate your models to generate forms or create them manually
33 lines • 1.02 kB
JavaScript
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { BaseInput } from "../inputs/base/BaseInput";
export class DynamicInputComponent {
constructor() {
this.formChange = new EventEmitter();
}
ngOnInit() {
}
isValid() {
return this.form.controls[this.input.name].valid;
}
getFormControl(input) {
return this.form.controls[input.name];
}
onChange() {
this.formChange.emit(this.form);
}
}
DynamicInputComponent.decorators = [
{ type: Component, args: [{
selector: 'ng-forms-input',
templateUrl: './dynamicInput.html',
changeDetection: ChangeDetectionStrategy.OnPush
},] },
];
/** @nocollapse */
DynamicInputComponent.propDecorators = {
"input": [{ type: Input },],
"form": [{ type: Input },],
"formChange": [{ type: Output },],
};
//# sourceMappingURL=DynamicInputComponent.js.map