【发布时间】:2015-03-25 21:33:29
【问题描述】:
我有下一个指令:schema、record、field 和 type。
在视图中,我使用模板中包含record 的schema 指令。
在record 模板中使用了field 指令,在field 指令中使用了type 指令。 (嵌套级别 = 4)
- 架构
- 记录
- 字段
- 类型
- 字段
- 记录
字段指令代码:
.directive("field", function(){
return {
restrict: "E",
replace: true,
transclude: true,
scope: {
field: '='
},
template: "<tr><td>{{field.name}}</td><type type='field.type'></type><td>{{field.type}}</td></tr>"
}
})
类型指令代码:
.directive("type", function($compile){
return{
restrict: "E",
replace: true,
transclude: true,
scope: {
type: '='
},
template: "<td>test</td>"
}
})
渲染field 和type 指令的部分输出:
size ["null","long"](type 指令评估没有结果)。
有趣的是,当我将type 指令高一级(在record 的模板内)时,一切都会正确呈现:
【问题讨论】:
标签: angularjs angularjs-directive