Experience the seamless integration of FullCalendar with Angular 5 for a dynamic and

Looking for assistance in integrating fullcalendar with Angular 5 seamlessly? Trying to implement it into a specific component and have already installed necessary packages:

  • jquery
  • moment
  • fullcalendar
  • fullcalendar-scheduler

Referencing this post on Stack Overflow as the closest solution found so far. Followed instructions but still encountering 'JQueryPromise' error. Appreciate any advice, thank you!

package.json

 "fullcalendar": "^3.8.0",
 "fullcalendar-scheduler": "^1.9.1",
 "jquery": "^3.2.1",
 "moment": "^2.20.1",

.angular-cli.json

 "styles": [
    "styles.css",
    "../node_modules/fullcalendar/dist/fullcalendar.min.css",
    "../node_modules/fullcalendar-scheduler/dist/scheduler.min.css"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/moment/min/moment.min.js",
    "../node_modules/fullcalendar/dist/fullcalendar.min.js",
    "../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
  ],

main.ts

import * as jQuery from "jquery";
(window as any).$ = (window as any).jQuery = jQuery;

app.component.html

<div id='calendar'></div#

app.component.ts

import { Component } from '@angular/core';
import 'fullcalendar';
import 'fullcalendar-scheduler';
declare let $: any;

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  ngOnInit() {
    $('#calendar').fullCalendar({});
  }
}

Despite following all steps diligently, errors persist. Can load after page refresh, but issues arise especially when first running 'ng serve'

ERROR in node_modules/fullcalendar/dist/fullcalendar.d.ts(695,36): error TS2304: Cannot find name 'JQueryPromise'.
...
(node_modules/fullcalendar/dist/fullcalendar.d.ts - continued list of errors)

Tried moving everything to a new component "schedule.component" but now facing additional errors:

Refused to load the font data:font/woff;base64,d09GRgABAAAAAGVUABEAAAAAxuQAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABHREVGAAAB .... (truncated for brevity) ... GxiEiDEzuGxUYewIjNjg0BGxkTnFZaMaiLeLo4GBkcWhIzkkAqQkEggceHw5HFkM2VRZJFlYebR2MP5v3cDSu5GJwWUDW9xG1hQXAFAmKZU= because it violates Content Security Policy directive: "default-src 'self'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.

Answer №1

The problem you faced has been resolved thanks to the GitHub issue that was raised.

I suggest executing

npm install --save-dev @types/jquery
to properly fix this issue. I came across the same issue and running this command solved it for me (after discovering this post and the link to the GitHub problem).

As stated in the GitHub fix: "this is now mentioned in the documentation: https://fullcalendar.io/docs/typescript/"

Answer №2

It appears that there may be an issue within the *.d.ts files located in the node_modules directory. I have created a problem report on the GitHub project

https://github.com/fullcalendar/fullcalendar/issues/3991

I made the necessary changes by replacing the type of certain issues with 'any':

node_modules/fullcalendar/dist/fullcalendar.d.ts
node_modules/fullcalendar-scheduler/dist/scheduler.d.ts

'JQueryPromise'
'JQueryEventObject'
'JQueryAjaxSettings'

Interestingly, after making these adjustments, the "Refuse to load font" problem also disappeared. I cannot provide any explanation for this. All I can confirm is that everything is functioning correctly now.

Wishing you happy holidays!

Answer №3

Your project is missing jquery typings. You can solve this by adding them with the following command

npm install --save-dev @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1abb0b4a4b3b881f2eff3eff6">[email protected]</a>

This issue was reported on the full calendar GitHub issue tracker (https://github.com/fullcalendar/fullcalendar/issues/3991)

Answer №4

Greetings! While I understand this question is a bit dated, the suggested solution of

npm install --save-dev @types/jquery
did not work for me either. I found a quicker fix:

  • Access the Manage NuGet Packages for Solution (Visual Package Manager option) at
    Tools>NuGet Package Manager> Manage NuGet Packages for Solution
  • Search for: jquery.type
  • Select the jquery.TypeScript.DefinitelyTyped package
  • Install it in your Web project
  • Issue resolved!

Hopefully, these steps will assist others facing the same dilemma as myself.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with MEAN app: unable to retrieve response from GET request

FETCH The fetch request is being made but no data is returned. There are no errors, just the fetch request repeating itself. app.get('/:shortUrl',async (req,res)=>{ try{ const shortUrl = await shorturl.findOne({ short: req.params.sh ...

Tips on showcasing multiple values using Angular 4?

Using angular 4 and spring boot, I retrieve a list of records from spring boot to angular 4 but only display a single object in the form. How can I list multiple values in the search box? component.ts: Within this component, all the values are retrieved b ...

Despite my efforts to properly run, my angular component is still not being added to the angular module

After attempting to execute ng generate component elements/ElementsHome, I encountered a successful run; however, the terminal did not display the Updated file path as a hyperlink. Instead, it indicated that the component was not created within the module. ...

What is the method to reach the DOM element of a different component in Angular?

My application is structured as follows: <nav></nav> <router-outlet></router-outlet> <footer></footer> Within the router-outlet, I have various components depending on the route. On some of these pages, I need to acces ...

Angular HttpClient does not support cross-domain POST requests, unlike jQuery which does

I am transitioning to Angular 13 and I want to switch from using jQuery.ajax to HttpClient. The jquery code below is currently functional: function asyncAjax(url: any){ return new Promise(function(resolve, reject) { $.ajax({ type: ...

Setting up a service endpoint for an Angular 4/5 application

Operating an Angular 4 application with a web API data service requires unique configuration for each of the 100 customers utilizing this setup. Each customer hosts their own version of the data service and Angular application on their IIS server, meanin ...

What is the best way to search for an Enum based on its value?

One of my challenges involves an enum containing various API messages that I have already translated for display in the front-end: export enum API_MESSAGES { FAILED_TO_LOAD = 'Failed to load data', TOKEN_INVALID = 'Token seems to be inva ...

Utilizing Typescript to inject dependencies and receive arguments within a class

I am currently using InversifyJS with the container. My goal is to inject the templateEngine and provide args (such as host, port, etc...) in the constructor. const container = new Container(); container.bind<MailerInterface>(TYPES.Mailer).to(NodeM ...

When using the ngFor directive, the select tag with ngModel does not correctly select options based on the specified

Issue with select dropdown not pre-selecting values in ngFor based on ngModel. Take a look at the relevant component and html code: testArr = [ { id : '1', value: 'one' }, { id : '2', ...

Problem encountered while implementing callbacks in redux-saga

I am facing a scenario in which I have a function called onGetCameras that takes a callback function named getCamerasSuccess. The idea is to invoke the external function onGetCameras, which makes an AJAX call and then calls getCamerasSuccess upon completio ...

The TypeScript compiler is generating node_modules and type declaration files in opposition to the guidelines outlined in the tsconfig.json file

For the past week, I've been trying to troubleshoot this issue and it has me completely puzzled. What's even more puzzling is that this app was compiling perfectly fine for months until this problem occurred seemingly out of nowhere without any c ...

Exploring the implementation of if/else statements in Sass/HTML

I need assistance with customizing the appearance of a save button on my form. The button is currently disabled and appears in blue color, but I would like it to change to a different color until all fields within the form are completed. Even though it c ...

Declaring UMD module in TypeScript: Generating typings for a UMD module authored in TypeScript

For the purpose of learning, I created a small TypeScript library and utilized webpack to generate a JS UMD module from my TypeScript code. Here is the structure of my project: |-dist |-js |-my-lib.min.js // Minified library as UMD module | ...

Angular 2's updated router feature, routerCanReuse, provides improved functionality

I'm curious about the changes in the Angular 2 router, particularly the removal of the CanReuse interface. Is there another feature in the router that can achieve the same functionality of forcing a component reload? ...

Is there a way to retrieve the ReturnType<T> for all methods within a class, even if the ReturnType<T> and its usage appear to be static?

After extensively reviewing the documentation on typescript at https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypet, I have come across two instances of ReturnType<T> mentioned. However, these instances appear to be statically ...

Encountering npm3 installation errors with typyings in Angular 2?

Each time I try to sudo npm install Angular 2 modules, everything updates and installs correctly. However, I encounter the following error when the typings install is attempted: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0 ...

Passing the value from a custom FormControl component to its parent component

I have successfully implemented a custom form control component with controlValueAccessor and it works well when used directly in a formGroup. Now, I am attempting to use this custom form control component within a "wrapper" component and then utilize the ...

Automating the linking of tsd definitions with bower and npm: A step-by-step guide

Currently, I am in the process of transitioning an existing project to TypeScript which includes numerous bower and npm dependencies (bower.json and package.json). As mentioned on the tsd github page, TSD facilitates the discovery and linking of defini ...

Dealing with Dependency Injection Problem in Angular 6

I am grappling with a challenge in my cross-platform Angular application. The crux of the issue is determining the platform on which the app is running and accordingly injecting services. Below is how I've structured it: @NgModule({ providers: [ ...

The presence of HttpInterceptor within a component is causing a ripple effect on all of the App

I am encountering an issue with a library I have that includes a component. This component has an HttpInterceptor that adds a header to each of its requests. The problem arises when I use the component in another project - the HttpInterceptor ends up addi ...