在angularjs自定义指令中使用时,ui-view不起作用

Meh*_*egh 1 javascript angularjs angularjs-directive angular-ui-router

我想在自定义angularjs指令中包含一些ui-view元素

<wrapper>
    <ul>
      <li><a ui-sref="route1">Route 1</a></li>
      <li><a ui-sref="route2">Route 2</a></li>
    </ul>

    <div class="well" ui-view="viewA"></div>        
    <div class="well" ui-view="viewB"></div>        
</wrapper>
Run Code Online (Sandbox Code Playgroud)

自定义指令除了转换内容外什么都不做:

myapp.directive('wrapper', function($compile){
    return {
        restrict: 'E',
        replace: true,
        transclude:true,
        template: '<div class="godWrapper" ng-transclude></div>'
    };
});
Run Code Online (Sandbox Code Playgroud)

请参阅 Plunker中的演示

似乎ui-view不喜欢被包装,因为当我删除包装元素时,演示工作没有问题.这是ui-router中的错误还是我做错了什么?

更新:

显然这是一个已知问题. 问题774问题886

Meh*_*egh 6

对不起,回答我的问题,而是通过角-UI-Router已知问题和源代码一些跳水之后,我发现这个问题是有角的UI路由器(最新版本0.2.8)的讨论在这里.以下演示使用0.2.7版本而没有提到的问题.也许这对其他人有用

http://plnkr.co/edit/u2LE7gFUGSpAmUNK3fhP?p=preview

  • 你可以回答自己的问题.http://stackoverflow.com/help/self-answer`问及回答你自己的问题不仅可以,而是明确鼓励的. (3认同)