Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
按照这个答案ng-switch的建议,我一直在尝试手动渲染控制器和模板,但是当模板包含指令时我无法让它工作。有任何想法吗?
ng-switch
这是小提琴:http: //jsfiddle.net/kynZm/
看起来ng-switch在我的链接函数有机会运行并链接到$rootScope. 将$compile调用移至指令的编译阶段似乎可以解决问题。
$rootScope
$compile
http://jsfiddle.net/z8uXg/