我正在使用requirejs中的八字胡模板和文本插件。
define(['text!templates/popups.html', 'mustache'], function (Mustache,popups) {
var mustacheTmpl = Mustache.render(popups, {jData:jsonObj});
}我想基于如下条件调用模块中的小胡子模板
define(['mustache'], function (Mustache) {
if ($('.element').length) {
require(['text!templates/mustachetemplate'],
function(mustachetemplate) {
var mustacheTmpl = Mustache.render(mustachetemplate, {jData:jsonObj});
})
}
}那件事怎么可能?
发布于 2014-02-22 05:31:12
我发现它实际上是以我的方式工作的。它失败的原因是因为其他一些代码正在阻塞。
https://stackoverflow.com/questions/21909918
复制相似问题