我在一个带有UI-router的项目中使用了Angular-Wizard,如果你点击右侧的“创建”按钮,你可以看到一个演示:
http://plnkr.co/edit/XYUamusHru7eV0nvAD5i?p=preview
该向导与当前项目分开工作正常,当我尝试将其集成到我的应用程序中时会出现问题,我在控制台中收到此错误:
Error: [ngTransclude:orphan] Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: <div class="steps" ng-transclude="">
我认为这与 UI-Router 中的模板逻辑有关,或者可能是指令的编写方式创建了“孤儿”。有人对问题出在哪里有任何想法吗?
最佳答案
看起来你的 NewCampaign.html 正在使用一些复制+粘贴的 dom,因为它有 Angular 注释 <!-- ngIF ... -->
清理模板后,您可以看到 wizard
该模板中未使用指令。 wz-step
指令需要在 wizard
的上下文中指令,因为嵌入发生在 wz-step
内.
此外,从模板中删除了额外的 ng-app 和 ng-controller。 Controller 应该与状态一起定义。在此处查看已修复的 plunkr:http://plnkr.co/edit/c3fcV5RSUMXGIFpk8AbV?p=preview
关于javascript - 非法使用 ngTransclude 指令与 UI Router 和 Angular-Wizard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22398042/