【问题标题】:angular material date-time picker - Throwing an error角度材料日期时间选择器 - 抛出错误
【发布时间】:2021-07-07 22:40:02
【问题描述】:

当我使用 Angular 材料日期时间选择器实现时,我收到一个错误记录到控制台。但它工作正常,只是我的测试因错误而失败。

https://www.npmjs.com/package/@angular-material-components/datetime-picker

<mat-form-field appearance="outline" floatLabel="auto" class="date-picker">
    <mat-label>From Date</mat-label>
    <input matInput [ngxMatDatetimePicker]="fromDatePicker" name="fromDate" [(ngModel)]="fromDate"
         placeholder="From Date">
    <mat-datepicker-toggle matSuffix [for]="fromDatePicker"></mat-datepicker-toggle>
    <ngx-mat-datetime-picker #fromDatePicker [showSpinners]="true" [showSeconds]="false"
         [stepHour]="1" [stepMinute]="10" [touchUi]="false">
    </ngx-mat-datetime-picker>
</mat-form-field>

ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, 
Promise, Array, or Iterable.
at subscribeTo (subscribeTo.js:27)
at subscribeToResult (subscribeToResult.js:11)
at MergeMapSubscriber._innerSub (mergeMap.js:59)
at MergeMapSubscriber._tryNext (mergeMap.js:53)
at MergeMapSubscriber._next (mergeMap.js:36)
at MergeMapSubscriber.next (Subscriber.js:49)
at Observable._subscribe (subscribeToArray.js:3)
at Observable._trySubscribe (Observable.js:42)
at Observable.subscribe (Observable.js:28)
at MergeMapOperator.call (mergeMap.js:21)

【问题讨论】:

标签: angular angular-material


【解决方案1】:

这可能是由于兼容性问题导致的,可以通过安装与您的核心 Angular 版本对应的适当版本的@angular-material-components/datetime-picker 来解决。

我遇到了同样的问题,但通过导入此软件包的正确版本解决了它。

感谢https://stackoverflow.com/a/66932554/13834563

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-01
    • 1970-01-01
    • 2018-09-13
    • 1970-01-01
    • 2018-07-16
    • 1970-01-01
    • 1970-01-01
    • 2022-12-17
    相关资源
    最近更新 更多