Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS composite view with the same directive
    primarykey
    data
    text
    <p>I have a question, about composite view in AngularJS, that is close to that one : <a href="https://stackoverflow.com/questions/16155232/angularjs-composite-components">AngularJS Composite Components</a></p> <p>However, I would like to know if it is possible to have a directive that includes a list of the same directive, like this :</p> <pre><code>&lt;mydirective name="thecontainer"&gt; &lt;mydirective name="a"/&gt; &lt;mydirective name="b"/&gt; &lt;mydirective name="c"/&gt; &lt;/mydirective&gt; </code></pre> <p>Thanks,</p> <p>David.</p> <p><strong>Edit</strong></p> <p>Answering blesh, I will be more precise. I'm trying to display boxes (a simple square) that can have one or many boxes, themselves can have many boxes, etc.</p> <p>Here is the directive</p> <pre><code>myApp.directive('box', function () { return { restrict:'E', replace:true, templateUrl:"partials/box.html", scope: { name : '@' }, link:function (scope, element, attrs, ctrl) { console.log("trying to log " + attrs.name); } } }); </code></pre> <p>Here is the template :</p> <pre><code>&lt;div class="box"&gt; &lt;div class="box-header"&gt; &lt;div&gt;{{ name }}&lt;/div&gt; &lt;/div&gt; &lt;div class="box-container"&gt; &lt;!-- display other boxes here--&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the interesting code in the view :</p> <pre><code>&lt;box name="TOP" &gt; &lt;box name="SUB" &gt; &lt;/box&gt; &lt;box name="SUB" &gt; &lt;/box&gt; &lt;/box&gt; </code></pre> <p>Obviously something is missing to tell the sub-boxes "hey please display in the right place into your parent and please, parent, adapt your size to the number of children you have"</p> <p>David.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload