Colleagues, in the directive trying to get descendants. The question is, if the descendants of the parent are added via ng-repeat, then element.children () returns an empty array.
But if I request through setTimeout () I achieve the desired result
const app = angular.module('app', []);
app.directive('example', function() {
  return {
    restrict: "C",
    link: function(scope, element, attrs) {
      scope.myExample = ['Example-1', 'Example-2', 'Example-3', 'Example-4', 'Example-5'];
      setTimeout(() => {
        console.log("TCL: element", element.children());
      }, 0)
    }
  }
});
app.directive('rootElement', function() {
  return {
    restrict: "ECA",
    //templateUrl: './pages/page-main/index.html',
    template: '<header>header</header><main>main</main><footer>footer</footer>',
    link: function(scope, element, attr) {
      console.log("rootElement", element.children());
    }
  }
});<html ng-app="app">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js"></script>
<menu class="example">
  <li class="li-example" ng-repeat="example in myExample"
      ng-click="active = !active" ng-class="active ? '' : 'li-example-active'">
     <span>{{example}}</span>
  </li>
</menu>
<hr/>
<root-element></root-element>
<html>Question - Is the correct decision to use setTimeout () or is there a more elegant and correct solution?
 
    