问题
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