我有一个指令,让我插入一个聊天组件。它根据需要加载一个模板。
mod.directive('chat', function () {
return {
replace: true,
templateUrl: '/tmpl/chat/chat',
}
})但问题是模板需要额外的包含:
.chat
.chatHeader(ng-include="'chatHeader'")
.chatLog(ng-include="'chatLog'")分音:
script( type="text/ng-template", id='chatLog')
.chatMsg(ng-include="'chatMsg'", ng-repeat='chatMsg in chatLog')
script( type="text/ng-template", id='chatHeader')
h3 Chat如何加载includes?我过去常常将分词放在与基本聊天模板相同的文件中,但如果我使用replace: true,这将不再被允许。
加载包含部分的标准角度方法是什么?
发布于 2013-07-21 11:38:46
原样使用ng-include是完全有效的。您面临的问题可能是因为您的模板partial没有恰好1个根元素。下面是您所描述的内容的一个工作版本:http://plnkr.co/wy1a3T1UdKOlBQXr9o22
https://stackoverflow.com/questions/16557255
复制相似问题