0

In my application, there are multiple forms and each forms having so many input field. for the same, I have created a template-driven component for multiple time use but I am not able to pass dynamically validation directive at time of calling component.

<div class="{{ _divTag.divClass }}" id="{{ _divTag.divId }}">
  <label for="{{ _inputTag.inputId }}" class="{{ _lableTag.labelClass }}">{{
      _lableTag.labelTitle
    }}</label>
  <input id="{{ _inputTag.inputId }}" class="{{ _inputTag.inputClass }}" type="{{ _inputTag.inputType }}"
    name="{{ _inputTag.inputName }}" placeholder="{{ _inputTag.inputPlaceholder }}" [(ngModel)]="modelValue" />
</div>

 <erp-input-control [_lableTag]="{ labelClass: 'lbl', labelTitle: 'State Code' }" [_divTag]="{
              divClass: 'col-sm-2 padding_left_0 pull-left',
              divId: 'div_state_code'
            }" [_inputTag]="{
              inputId: 'state_code',
              inputName: 'state_code',
              inputClass: 'form-control',
              inputPlaceholder: 'State Code',
              inputType: 'text'
            }" [_directive]="{ inputDirective: 'erpRequired' }"[(modelValue)]="_stateModel.state_code">
          </erp-input-control>

In this case I want do validation [_directive]="{ inputDirective: 'erpRequired' }" but its not working.

knshah2009
  • 11
  • 1
  • Refer this https://stackoverflow.com/questions/39678963/load-existing-components-dynamically-angular-2-final-release – hrdkisback Sep 16 '19 at 13:42
  • Possible duplicate of [Load existing components dynamically Angular 2 Final Release](https://stackoverflow.com/questions/39678963/load-existing-components-dynamically-angular-2-final-release) – Goran Gajic Sep 16 '19 at 13:45

0 Answers0