ngx-daterangepicker-material: AOT compilation error
Hello, I am using v.1.3.0 with Angular 7 and works fine with a simple ng-serve
, but when I build the application with ng-build
and AOT enabled, it fails with the following error:
ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'weekdaysMin' was called in 'ɵb'
'ɵb' calls 'weekdaysMin' at ../ngx-daterangepicker-material/ngx-daterangepicker-material.ts(24,17).
I import the picker module in my app module with NgxDaterangepickerMd.forRoot().
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 16 (2 by maintainers)
Commits related to this issue
- chore(package): upgrade and fixes * upgrade angular version * upgrade packagr version * Aot Fix #79 Closes #81 #83 — committed to fetrarij/ngx-daterangepicker-material by fetrarij 5 years ago
- chore(package): upgrade and fixes * upgrade angular version * upgrade packagr version * Aot Fix #79 Closes #81 #83 — committed to fetrarij/ngx-daterangepicker-material by fetrarij 5 years ago
above issues i got solution
localconfi: any = { applyLabel: 'ok',separator: ' To ', format: 'ddd, MMMM D, YYYY h:mm A', direction: 'ltr', weekLabel: 'W', cancelLabel: 'Cancel', customRangeLabel: 'Custom range', daysOfWeek: moment.weekdaysMin(), monthNames: moment.monthsShort(), firstDay: moment.localeData().firstDayOfWeek() };
<input matInput type="text" ngxDaterangepickerMd [(ngModel)]="selected" (ngModelChange)="datepickerChange($event)" [alwaysShowCalendars]="true" [ranges]="ranges" [showClearButton]="true" [locale]="localconfi" placeholder="Double Click for Date" class="form-control" required/> </mat-form-field>
NgxDaterangepickerMd.forRoot({ separator: ' To ', applyLabel: 'Okay', format: 'ddd, MMMM D, YYYY h:mm A' })
@ashokvarmauppalapati hi , can u check your
package.json
?If you a using
^1.2.7
. And runnpm install —force
accidentally, it may reinstall the1.3.0
.Just a gentle reminder, I made the same mistake a few days ago. Better fix the version to
1.2.7
with 1.2.7 , it should work without forRoot(). I will fix for 1.3.0. Thanks @georgiyolovski