I recently began using a JavaScript plugin that utilizes jQuery to convert XML to JSON. You can find the plugin here.
Initially, this plugin worked smoothly within my older AngularJs application. However, after upgrading to Angular7, I am facing challenges while setting it up.
To include both jQuery and the plugin in the project, I added the following lines in the `angular.json` file:
script: [
"node_modules/jquery/dist/jquery.slim.js",
"src/app/plugins/jquery.xml2json.js" //Please note that I have rearranged the order of scripts
]
Following this setup, I attempted to use the plugin as shown below:
// app.component.ts
import * as $ from 'jquery'
export class AppComponent{
myFunction() {
let xmlDocument = "<tree>test</tree>";
$.xml2json(xmlDocument);
}
}
However, upon execution, I encountered the following error message:
_plugins_jquery_xml2json_js__WEBPACK_IMPORTED_MODULE_3__.xml2json is not a function
Can anyone provide guidance or suggestions on how to resolve this issue?