By norweny


2016-07-07 14:29:08 8 Comments

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

ReferenceError: jQuery is not defined.

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

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 excerpt:

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)

2 comments

@mrgoos 2016-10-16 21:42:25

You can also add just this:

<script src="node_modules/primeui/primeui-ng-all.min.js"></script>

Or, if you're using the angular-cli like me you can npm i primeui and add this to your angular-cli.json:

"scripts": ["../node_modules/primeui/primeui-ng-all.min.js"]

Update

in beta.19 The dependency of JQuery has been removed.

Reference: http://blog.primefaces.org/?p=4149

@Sergio 2016-07-07 20:55:48

You need to add the dependencies:

<!-- 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>

@daveoncode 2016-10-07 09:49:47

this is so sad :(

@Sergio 2016-10-07 10:16:16

Well, In the bright side the team is working to remove third party dependencies from calendar :)

@Cagatay Civici 2016-10-22 10:52:03

Beta19 has a native calendar, not jquery based. blog.primefaces.org/?p=4149

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] primeNG calendar select dates by default

0 Answered Questions

PrimeNG Calendar change date fomat ddMMyyyy to dd.mm.yy

1 Answered Questions

[SOLVED] PrimeNG p-calendar - disableDate format

1 Answered Questions

PrimeNG calendar not hiding after selection of value

0 Answered Questions

Angular calendar - PrimeNG

1 Answered Questions

[SOLVED] Angular2 - PrimeNG calendar timeOnly unconfigured

2 Answered Questions

[SOLVED] How to set calendar using PrimeNG calendar?

1 Answered Questions

[SOLVED] Open PrimeNG calendar programmatically

0 Answered Questions

PrimeNG Calendar dynamic placement/positioning

1 Answered Questions

[SOLVED] Binding object attribute to inputtext

Sponsored Content