Carbon isolated directive with ng-repeat break

I would really appreciate an understanding of this problem that I encountered while developing an isolated sandboxed directive where re-inclusion is repeated inside the template.

I promise that I already understand how isolated and translucent areas work, and I have already searched the Internet for an answer. :)

What I find here is that when you are not using repeat, my transcluded html can access the parent scope (as I would expect, since the transcluded scope is a child of the parent scope).

However, the moment I change my template to repeat the transition, the parent area is no longer available for transidated html.

I am sure that there is a good reason for this, but I canโ€™t put pressure on her for life.

Please see the "nofollow"> plunker example here - it will explain what I mean better than words can.

+4
source share
1 answer

What happens to ng-repeat is that the transcluded scope (00A below) becomes a child of the ng-repeat scope (009), and not a child of the controller scope (003).

(Right-click on the image and open it in a new tab to see it better.)

enter image description here

Since there is no dashed line from the allocation region 006 from the controller region 003, the transcluded region 00A cannot find outer using the prototype chain / inheritance search.

(Scopes 004 and 005 are created by the working directive. Transcluded scope 005 can find outer using prototype inheritance.)

+8
source

Source: https://habr.com/ru/post/1482521/


All Articles