PrimeNG日历错误-未定义JQuery [英] PrimeNG Calendar error - JQuery is not defined

查看:100
本文介绍了PrimeNG日历错误-未定义JQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用中使用 PrimeNG日历.运行代码时,出现错误:

I want to use PrimeNG calendar in my app. When I run the code, I get the error:

ReferenceError:未定义jQuery.

ReferenceError: jQuery is not defined.

其他PrimeNG指令也可以正常工作.如果删除<p-calendar>,错误消失.

Other PrimeNG directives work fine. If I remove <p-calendar> the error disappears.

我已将日历导入并包含在我的应用程序中. 顺便说一下,我正在使用最新版本的angular,router和form.在此之前,我有此问题,并通过更新表单提供程序对其进行了修复.

I have imported and included Calendar in my app. By the way I'm using the latest versions of angular, router and forms. Before that I had this issue and fixed it by updating form providers.

 <p-calendar [(ngModel)]="date"></p-calendar> 

Stacktrace摘录:

Stacktrace excerpt:

ReferenceError:未定义jQuery 在Calendar.ngAfterViewInit处(例如,在( http://localhost:8080/js/app中进行评估. js:930:2 ),:44:90) 在DebugAppView._View_AddShipmentComponent0.detectChangesInternal(AddShipmentComponent.template.js:930:59) 在DebugAppView.AppView.detectChanges(在( http://localhost:8080/js/vendor.js:716:2 ),:243:14) 在DebugAppView.detectChanges中(例如,在( http://localhost:8080/js/vendor中. js:716:2 ),:348:44)

ReferenceError: jQuery is not defined at Calendar.ngAfterViewInit (eval at (http://localhost:8080/js/app.js:930:2), :44:90) at DebugAppView._View_AddShipmentComponent0.detectChangesInternal (AddShipmentComponent.template.js:930:59) at DebugAppView.AppView.detectChanges (eval at (http://localhost:8080/js/vendor.js:716:2), :243:14) at DebugAppView.detectChanges (eval at (http://localhost:8080/js/vendor.js:716:2), :348:44)

推荐答案

您需要添加依赖项:

<!-- Datetimepicker, Slider, Schedule -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.1/jquery-ui-timepicker-addon.min.js"></script>

这篇关于PrimeNG日历错误-未定义JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆