Cannot read property 'empty' of undefined
Hi.
I just installed the datetime module and i seem to be getting an error when i try to load the new module. i've tried several different imports without any luck. I'm getting this error when trying to instantiate the
Error: Uncaught (in promise): Error: Error in ./myComponent class myComponent - inline template:50:0 caused by: Cannot read property 'empty' of undefined TypeError: Cannot read property 'empty' of undefined at i._updateDatepicker (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:3223) at HTMLInputElement.eval (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:24703) at Function.each (eval at module.exports (scripts.bundle.js:1), <anonymous>:368:19) at jQuery.fn.init.each (eval at module.exports (scripts.bundle.js:1), <anonymous>:157:17) at jQuery.fn.init.t.fn.datepicker (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:24635) at NKDatetime.updateDatepicker (ng2-datetime.ts:241) at NKDatetime.updateModel (ng2-datetime.ts:218) at NKDatetime.init (ng2-datetime.ts:214) at NKDatetime.ngAfterViewInit (ng2-datetime.ts:75) at CompiledTemplate.proxyViewClass.View_myComponent0.detectChangesInternal (/myModule/myComponent/component.ngfactory.js:528) at CompiledTemplate.proxyViewClass.AppView.detectChanges (view.js:425) at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (view.js:620) at CompiledTemplate.proxyViewClass.AppView.internalDetectChanges (view.js:410) at CompiledTemplate.proxyViewClass.View_myComponent_Host0.detectChangesInternal (/myModule/myComponent/host.ngfactory.js:29) at CompiledTemplate.proxyViewClass.AppView.detectChanges (view.js:425) at i._updateDatepicker (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:3223) at HTMLInputElement.eval (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:24703) at Function.each (eval at module.exports (scripts.bundle.js:1), <anonymous>:368:19) at jQuery.fn.init.each (eval at module.exports (scripts.bundle.js:1), <anonymous>:157:17) at jQuery.fn.init.t.fn.datepicker (eval at module.exports (scripts.bundle.js:1), <anonymous>:9:24635) at NKDatetime.updateDatepicker (ng2-datetime.ts:241) at NKDatetime.updateModel (ng2-datetime.ts:218) at NKDatetime.init (ng2-datetime.ts:214) at NKDatetime.ngAfterViewInit (ng2-datetime.ts:75)
I've followed the guide to add the dependencies in the correct order, and added the module to my child module. I only get this error with datepicker - i've added the modules seperately to identify which one is giving me the error and datetime works perfectly which is why i'm at a loss. It seems bootstrap is added correctly. Also when i get the error, the datepicker still works, i can open it and it looks great. I can pick a date and use it as i would expect it to - which makes me think this isn't an import issue?
this is the code i use when i get the error: <datetime [timepicker]="false" [(ngModel)]="date2"></datetime>
i'm using jQuery v. 3.1.x - angular cli version 1.0.0 beta 25.5 - angular v. ^2.3.1 - bootstrap v. ^3.3.7 - bootstrap datepicker v. 1.6.4 -
Kind regards Chris
+1
+1