Member 9579525 Ответов: 0

Метка не отображается для пользовательского средства выбора даты в ngx-formly/bootstrap


I am creating dynamic UI/form using ngx-formly/bootstrap(not using material). I want to display datepicker control so I have displyed custon bsdatepicker control using ngx-bootstrap/datepicker. But label is not displaying when I give it to in templateOptions
I tried following way.

What I have tried:

1. Create a component which contains html for date picker

<pre>import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
       //datepicker.component.html
       <input type="text" 
       id="dob-id" 
       class="form-control calendar" 
       placement="bottom" 
       bsDatepicker
       [formlyAttributes]="field"
       #dobDate="bsDatepicker" 
       [bsConfig]="bsConfig" 
       placeholder="YYYY-MM-DD"
       [class.is-invalid]="showError" class=""  style="width: 350px;">

       //datepicker.component.ts
       import { Component, OnInit } from '@angular/core';
       import { FieldType } from '@ngx-formly/core';
       import { BsDatepickerConfig } from 'ngx-bootstrap';

       @Component({
       selector: 'app-datepicker',
       templateUrl: './datepicker.component.html',
      styleUrls: ['./datepicker.component.scss']
      })

      export class CustomDatepickerComponent extends FieldType {
     // Optional: only if you want to rely on `MatInput` implementation
     bsConfig: Partial<BsDatepickerConfig> = {
     : 'YYYY-MM-DD',
     showWeekNumbers: false,
     containerClass: 'theme-dark-blue'    
     };
     }


В приложение.модуль у меня прописано, что компонент а в компонент, в котором я определил схему,

{
ключ: 'date1',
тип: 'bsdatepicker',
templateOptions: {
этикетка :"от даты",
требуется: true
},
expressionProperties: {
//'templateOptions.этикетка": "от даты"
}
},

0 Ответов