I am trying to affect a variable in the parent scope to switch ng-show from inside the directive. A directive is a custom directive containing the ng-repeat directive. The idea is that after ng-repeat completes, I want to hide the contained div, as well as the elements inside it.
Here Plunkr demonstrates my situation: http://beta.plnkr.co/edit/C42Z25?p=preview Also here is a comparison in JSFiddle that uses the same problem but it is not ng-repeat and therefore it works: http: / /jsfiddle.net/dyzPC/
So there are a few problems. Inside my directive I have to use scope.$parent.showMe = true to change the showMe parent area, I cannot just use scope.showMe = true to set it. I tried with selection areas, without areas, true areas, nothing works.
Also, in the jquery callback function, I cannot represent the reset showMe parent area as scope.$parent.showMe = false . This prevents me from showing the contained div when there is content and hiding it when there is no content.
On the one hand, one of the last problems is the use of $last . In the plunkr example, using $ last is possible, but in my real code, the ng-repeat collection is populated from an HTTP interceptor. This seems to prevent the use of $ last, since all elements end as $last = true . Is there any other way to detect when ng-repeat is complete?
source share