指令在与另一个嵌套时停止工作?

时间:2015-01-16 01:24:47

标签: angularjs directive

我试图在示例上嵌套一些指令,看起来我得到了我需要的所有东西,但没有按照我的预期工作,但是如果我把嵌套指令从父指令中删除它就会被识别出来

    here is a plunker:http://plnkr.co/edit/eZaYTHm274zWx8GPMAS0?p=preview

这个嵌套指令的主要目的是在控制器之间共享数据并动态构建一组字段。

提前致谢!

资源:https://docs.angularjs.org/guide/directive

1 个答案:

答案 0 :(得分:0)

您的代码有两个问题:restrict属性和transclude / template属性。请参阅下面的代码摘录。

return {
    restrict: 'AE', //You need to add "A" if you are using attributes
    transclude: true, // You need to include the ng-transclude directive in your template
    template: '<div> Some Html <div ng-transclude></div></div>',
    ...
};
相关问题