Closed POFerro closed 2 years ago
@POFerro it's an enum value.
Specify in HTML like this:
<owl-date-time [startView]="startView" #date_range_component [startAt]="currentValue" [endAt]="endValue"></owl-date-time>
Then in ts, create a variable to bind to:
public startView: DateView;
ngAfterViewInit() {
this.startView = DateView.MULTI_YEARS;
}
None of this changed, so it should work as previously. Maybe Angular changed how you can bind to enum types in NG11, and you cant use direct string -> enum any more.
Hi @danielmoncada ,
Thanks for the answer :).
This was broke on PR: #95 if you check the difference in calendar.component.ts you can see the type of startView has changed from string (restricted) to enum and this causes a break in angular templates.
Is this going to be reviewed? Will this be the future behavior? Currently the only solution I see for this to work is by declaring a variable in component controller .ts like public DateView = DateView; or having the variable like you said, previous solution was more clean.
Perhaps a in middle solution would be to have a type declared with the string restriction to be able to reuse it but still be a string :).
Thanks and best regards POFerro
Hi @danielmoncada and @POFerro,
Actually DateView is not exported in "@danielmoncada/angular-datetime-picker". The workaround I found was to re-declare
export enum DateView {
MONTH = 'month',
YEAR = 'year',
MULTI_YEARS = 'multi-years'
}
export type DateViewType = DateView.MONTH | DateView.YEAR | DateView.MULTI_YEARS;
and use this one instaed...
Thanks and best regards Renato Vieira
@khalla and @POFerro added DateView enum to api, per https://github.com/danielmoncada/date-time-picker/pull/142.
Will be available in 13.0.1.
Hi,
Since I installed the version 11.0.0 I can't no longer set startView in html. I get the error: Type '"year"' is not assignable to type 'DateView'
The sample as shown in: https://daniel-projects.firebaseapp.com/owlng/date-time-picker#starting-view doesn't seem to be working any more.
Am I missing something? How do I set startView from the html view?
Thanks and best regards POFerro