It's possible Overwrite mat-monthly-view component on mat-datepicker to add week number column?

自作多情 提交于 2020-01-05 04:24:05

问题


I'm trying to add a week number column to the mat-monthly-view component used in the mat-datepicker component from angular material. I thought to extends the current mat-monthly-view and in some how tell to my module that when the mat-monthly-view are called substitute it by my extended one. But i do not find the way. have Angular support for this kind of solutions?

UPDATED

Module:

providers: [
    { provide: MatMonthView, useClass: MyMonthView},
]

componet:

@Component({
  selector: 'my-month-view',
  templateUrl: './monthly-view.component.html',
  styleUrls: ['./monthly-view.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class MyMonthView<D>  extends MatMonthView<D> {

  constructor(
    _changeDetectorRef: ChangeDetectorRef,
    @Inject(MAT_DATE_FORMATS) _dateFormats: MatDateFormats,
    _dateAdapter: DateAdapter<D>
  ) {
    super(
      _changeDetectorRef,
      _dateFormats,
      _dateAdapter
    );
  }
}

I do not get errors but the component in the datepicker month view is the same and not my new one.

来源:https://stackoverflow.com/questions/57955904/its-possible-overwrite-mat-monthly-view-component-on-mat-datepicker-to-add-week

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!