File

src/app/shared/dynamic-form/smart/dynamic-form.component.ts

Implements

OnInit

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

Constructor

constructor(dynamicFormService: DynamicFormService)
Parameters :
Name Type Optional
dynamicFormService DynamicFormService No

Inputs

config
Type : DynamicFormConfig

Outputs

onSubmit
Type : EventEmitter<any>

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

formGroup
Type : FormGroup
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
Component
Html element with directive

result-matching ""

    No results matching ""