在我的MVC应用程序中,我想使用。我试着用下面的方式;
@Scripts.Render("~/bundles/require")
在require.js文档中,它被记录为;
<!--This sets the baseUrl to the "scripts" directory, and
loads a script that will have a module ID of 'main'-->
<script data-main="scripts/main.js" src="scripts/re
尽管我包含了我的require-min.js,但它并没有从require.config中获取我的paths。我使用data-main方法加载配置文件。
<!--when require.js loads it will inject another script tag
(with async attribute) for scripts/main.js-->
<script data-main="scripts/main" src="scripts/require.js"></script>
您通常会使用数据主脚本
以下是我的代码:
HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using Require js for modular loading of scripts.</title>
<!--Requirejs first loads the module that is specified in data-main .. So it will load the module init,in
下面是我在durandal应用程序中的cshtml代码
<script type="text/javascript" src="~/Scripts/require.js"
id="countryscript" data-main="**here i have to set value**"></script>
我想用javascript变量值设置脚本属性数据-主。如何做到这一点?
我试过
document.getElementById("countryscript").data-mai
使用requireJS加载jquery.jstree.js在IE中不起作用。
当我尝试使用requireJS加载JSTree插件(jquery.jstree.js)时,它在IE8中失败,并出现以下JS错误。
Message: Could not get the type property. Invalid argument.
Line: 109
Char: 463
Code: 0
URI: file:///...../js/requireplugins-jquery-1.4.3.js
我已经在其他浏览器(FF和Chrome)上测试过了,它在那里工作得很好。而且,它在IE中对其他jQuery插件