相关疑难解决方法(0)

为什么ng-transclude的范围不是其指令范围的子代 - 如果指令具有隔离范围?

给定container1带有transclude 的指令()和一个隔离的范围,当指令链接时,我有这些范围:

Scope 004           <-- scope of the body
    Scope 005       <-- scope of directive container1
    Scope 006       <-- scope of the ng-transclude
Run Code Online (Sandbox Code Playgroud)

我期望:

Scope 004            <-- scope of the body
    Scope 005        <-- scope of the directive
         Scope 006   <-- scope of the ng-transclude
Run Code Online (Sandbox Code Playgroud)

如果同一指令具有共享范围而不是隔离范围,则会得到预期结果.

这导致了一个问题,因为如果被转换的内容包含另一个component1带有隔离范围的指令(),我得到:

Scope 004             <-- scope of the body
    Scope 005         <-- scope of the directive
    Scope 006         <-- scope of the ng-transclude
          Scope 007   <-- scope …
Run Code Online (Sandbox Code Playgroud)

angularjs

31
推荐指数
3
解决办法
1万
查看次数

标签 统计

angularjs ×1