我有 Angular 1.x/jQuery 项目,我已经加载了所有前端库,如 jQuery.js、require.js、angular.js。现在我计划与 Madcap 文档库集成。他们提供了另一组相同的前端 jQuery/require js 库,它与我项目的现有版本不同。如何在不与现有 UX 库冲突的情况下加载新的 madcap 库?
我们的项目中有一个 angular-summernote,它会抛出类似的错误
TypeError: element.summernote is not a function.
我尝试了如下的 jquery noConflict 选项,但它不起作用:(还有其他选项可以尝试加载库吗?
<html>
<head>
<script src="./assets/global/plugins/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<script>
$.noConflict(true);
var jq = jQuery;
jq(document).ready(function($){
jq.ajax({
url: '/login',
type: 'PUT',
success: function (response) {
var url = "app.min.js?v=" + response.clientGitHash;
jq.ajax({
url: url,
type: 'GET',
dataType: 'script',
cache: true,
success: function (data, textStatus, jqxhr) {
console.log("Successfully Loaded.");
//i want to enforce the below getscript use only the default loaded jquery and not having conflict with further loading library.
jq.getScript("scripts/summernote-bs4.min.js", function(data2, textStatus2, jqxhr2) {
console.log("Loading SummerNote ");
});
}
});
}
});
});
</script>
<script src="scripts/helpDoc/Default.js"></script> // This is a vendor file from madcap which loads it versions of jquery, requiresjs etc.
</script>
</body>
</html>