Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

Customize calendar header using [calendarHeaderComponent] #35

Closed
arihs opened this issue Sep 12, 2018 · 11 comments
Closed

Customize calendar header using [calendarHeaderComponent] #35

arihs opened this issue Sep 12, 2018 · 11 comments

Comments

@arihs
Copy link

arihs commented Sep 12, 2018

I am trying to customize the Sat Datepicker calendar header using my own component, but it is ignoring the Input.

This does not work:
<sat-datepicker #picker [calendarHeaderComponent]="exampleHeaderComponent" [rangeMode]="true"></sat-datepicker>

But it does work with Mat Datepicker:
<mat-datepicker #picker [calendarHeaderComponent]="exampleHeaderComponent"></mat-datepicker>

What am I doing wrong?

@SaturnTeam
Copy link
Owner

My bad. I'll try to fix now or tommorow

@SaturnTeam
Copy link
Owner

try 6.1.1. if it's not working, please create a demo https://stackblitz.com/edit/angular-4cfnyl

@arihs
Copy link
Author

arihs commented Sep 16, 2018

Sorry, but it's still not working. Now, the entire datepicker box that opens is empty.

I created a demo - basically an exact copy of material design's customized header.
(https://material.angular.io/components/datepicker/overview#customizing-the-calendar-header): See
https://stackblitz.com/edit/angular-zxjajr

Thanks for your help! It's much appreciated.

@SaturnTeam
Copy link
Owner

example from angular material not working too :)
You forgot to configure NgModule and import class from saturn-datepicker

here is working example:
https://stackblitz.com/edit/angular-ecwjqo?file=src/app/app.module.ts

@arihs
Copy link
Author

arihs commented Sep 16, 2018

Thank you!

@arihs
Copy link
Author

arihs commented Sep 16, 2018

Is there a way to EDIT the calendarHeader component, rather than REPLACE it entirely? [Or, alternatively, is it possible to reuse the date selection (dropdown and fwd/bck navigation for months) in my replacement header component? (I don't want to have to rewrite that)]
I am trying to add a simple toggle switch to the calendar header (yes, it has to be in the calendar component).

@SaturnTeam
Copy link
Owner

No, but you can copy-paste source code of original header

@arihs
Copy link
Author

arihs commented Sep 16, 2018

There's no way of extending SatCalendarHeader or MatCalendarHeader?

@SaturnTeam
Copy link
Owner

Extending components is not thing that angular can do now (if I remember correctly).

@arihs
Copy link
Author

arihs commented Sep 16, 2018

Update: I did extend SatCalendarHeader on my customHeaderComponent and it works like a charm.
Thanks!

@Imansh338
Copy link

I have a similar Problem, I am trying to implement the calenderHeaderComponent from an existing mat datepicker into a sat datepicker. but the pop-up showing up blank white. the error on console is :

ERROR Error: StaticInjectorError(AppModule)[ExampleHeader -> MatCalendar]:
StaticInjectorError(Platform: core)[ExampleHeader -> MatCalendar]:
NullInjectorError: No provider for MatCalendar!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get

any Advice! Thanx 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants