[英]When Loading html file with require.js error with extension
我有档案
reg.html
<label>Name:</label>
在require.config中:
requirejs.config({
paths: {
reg:"/templates/reg.html"
}
})
当我尝试加载模板时:
define('ng_start',["angular","jquery","reg"],function(An,$,template){
....
})
GET /templates/registry.html.js?bust=1417489939824228.12310815788805 require.js:166未捕获错误:脚本错误:注册表http://requirejs.org/docs/errors.html#scripterror
如何从registry.html.js删除js扩展名?
您需要声明您的“reg”模块将作为文本而不是JavaScript模块加载。 有关详细信息,请参阅以下
https://github.com/requirejs/text
您的具体代码应为:
define('ng_start',["angular","jquery","text!reg"],function(An,$,template){
....
})
注意 :添加text!
在reg
的模块定义要求中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.