It seems you're creating some sort of dynamic form (display date picker if data is of type date ...) We have been using either ngx/formly or some angular dynamic component creation mechanism: https://angular.io/api/core/ComponentFactory
Hope this helps *Bastien Lemaire* On Wed, 10 Mar 2021 at 11:39, [email protected] <[email protected]> wrote: > hi, as you can see in my code below, I am repeating code. I was just > wondering what the best way would be to refactor this code: > > ``` > <div class="my-2" *ngSwitchCase="'BPFDateTimeElement'"> > <core-date > [control]="form.get(section.objectID).get(rowElement.objectID)" > [element]="rowElement" > ></core-date> > </div> > <div class="my-2" *ngSwitchCase="'BPFBooleanElement'"> > <core-boolean > [control]="form.get(section.objectID).get(rowElement.objectID)" > [element]="rowElement" > ></core-boolean> > </div> > <div class="my-2" *ngSwitchCase="'BPFEntryElement'"> > <core-input > [control]="form.get(section.objectID).get(rowElement.objectID)" > [element]="rowElement" > ></core-input> > </div> > <div class="my-2" *ngSwitchCase="'BPFTextViewElement'"> > <core-textarea > [control]="form.get(section.objectID).get(rowElement.objectID)" > [element]="rowElement" > ></core-textarea> > </div> > <div class="my-2" *ngSwitchCase="'BPFPicklistElement'"> > <core-pick-list > [control]="form.get(section.objectID).get(rowElement.objectID)" > [element]="rowElement" > ></core-pick-list> > ``` > > -- > You received this message because you are subscribed to the Google Groups > "Angular and AngularJS discussion" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/angular/2818053c-c552-4084-a846-9bad28f832c7n%40googlegroups.com > <https://groups.google.com/d/msgid/angular/2818053c-c552-4084-a846-9bad28f832c7n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/CAJ7E9zF3boyPbm19QbPxTMcxbgTyCR1CsYEWuiHeCtCBCbYotg%40mail.gmail.com.
