Включите все дочерние элементы внутри компонента с AngularJS 1.5 - PullRequest
0 голосов
/ 04 июля 2018

Учитывая этот HTML

<parent>
  <child></child>
  <child></child>
  <child></child>
</parent>

Как мне включить все элементы <child> внутри элемента <parent>?

Вот что у меня есть:

angular.module('foo', [])
   .component('parent', {
      restrict: "E",
      template: '<!-- template -->' +
                '<ng-transclude></ng-transclude>',
      transclude  : true,
      controller: function ($scope, $element) {
        /* code */
      }
   })
   .component('child', {
      restrict: "E",
      require: {
        parent: '^parent',
      },
      template: '<!-- template -->',
      controller: function ($scope, $element) {
        /* code */
      }
   })
;

Однако, только первый <child> включен.

Как я могу сделать так, чтобы все дети были зачтены?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...