【问题标题】:ngx-bootstrap/datepicker not rendering and generating error BsDatepickerDirective -> BsDatepickerConfigngx-bootstrap/datepicker 不渲染和生成错误 BsDatepickerDirective -> BsDatepickerConfig
【发布时间】:2021-01-05 19:13:56
【问题描述】:

我刚刚通过 ngx-bootstrap 为我的基本 Angular 应用程序进行日期选择器控制,但遇到以下错误

ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[BsDatepickerDirective -> BsDatepickerConfig]: 
  StaticInjectorError(Platform: core)[BsDatepickerDirective -> BsDatepickerConfig]: 

sn-p 来自 app.module.ts

import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';

@NgModule({
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    BsDatepickerModule.forRoot()

这是html sn-p

        <div class="form-group">
            <label for="doj">DOJ:</label>
            <input type="text" bsDatepicker  
            formControlName="DOJ" class="form-control" name="doj" id="doj">
        </div>

【问题讨论】:

    标签: angular datepicker ngx-bootstrap


    【解决方案1】:

    将 BsDatepickerConfig 添加到应用程序模块中的 providers:[],这对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-12
      相关资源
      最近更新 更多