I'm developing an SPFx webpart with AngularJS and Kendo UI. Kendo UI requires jQuery before AngularJS. As I want to develop multiple webparts with AngularJS and Kendo UI I decided to reference AngularJS and Kendo UI from external cdns.
This is the externals section in my config.json:
"externals": {
"jquery": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js",
"globalName": "jquery"
},
"angular": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js",
"globalName": "angular",
"globalDependencies": [
"jquery"
]
},
"kendo": {
"path": "https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js",
"globalName": "kendo",
"globalDependencies": [
"jquery",
"angular"
]
}
},
I load AngularJS and Kendo UI in my Webpart.ts file:
import * as angular from "angular";
import "kendo";
My Angular app is working and the kendo.all.min.js file is loaded. I try to load the Kendo module like this:
angular.module("TestExternalWebpart", [ "kendo.directives" ]);
I get the following error from AngularJS:
Module 'kendo.directives' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
I've already tried to load Kendo with the following code in my webpart but I get same error:
import * as angular from "angular";
require("kendo");
How can I load Kendo UI from external cdn in a SPFx webpart?