这是plunker:
http://plnkr.co/edit/4SakSg6x5wuQQ5eYBwFN?p=preview
如您所见,我有两个自定义指令:child-one 和 child-2。这两个指令在所有方面都是相同的,除了:
1. child-one is within an html element that has the attribute ng-controller; and,
2. child-two is not within such an html element, rather it's ng-controller is acquired thru the
directive's .compile method, retrieving the controller thru the attribute var-ctrl.
孩子一确实填充了这些项目,孩子二没有。
问题:
如果我不希望 ng-controller 在指令之外,我必须对 child-2 做什么才能使其发挥作用?