【发布时间】:2016-11-08 09:34:07
【问题描述】:
我正在尝试为 angular app 中的网格可编辑弹出窗口加载 html 模板。
在我添加的html页面中
<script>
var templateLoader = (function($,host){
//Loads external templates from path and injects in to page DOM
return{
loadExtTemplate: function(path){
var tmplLoader = $.get(path)
.success(function(result){
//Add templates to DOM
$("body").append(result);
})
.error(function(result){
alert("Error Loading Templates -- TODO: Better Error Handling");
});
tmplLoader.complete(function(){
$(host).trigger("TEMPLATE_LOADED", [path]);
});
}
};
})(jQuery, document);
/*
** Load the template file
*/
templateLoader.loadExtTemplate("tpl/Maintenance/policyProp.htm");
/*
** Loading external templates with in this function.
*/
</script>
在网格内:
editable: {
confirmation: true,
mode: "popup",
template: kendo.template($("#Policy_editor").html())
},
htm 页面:
<script type="text/x-kendo-template" id="Policy_editor" >
html code here
.
.
.
.
</script>
我希望“#Policy_editor”来自外部 html 页面。 感谢您的帮助!
【问题讨论】:
标签: javascript angularjs kendo-ui kendo-grid kendo-template