Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Proposal for multiple transclusion targets #4350

@ravinggenius

Description

@ravinggenius

When transcluding into a directive, it would be super useful to specify multiple targets. Polymer makes this easy with the <content /> element, together with the [select] attribute.

What I'm proposing is to allow [ng-transclude] (in the target directive template) to take an optional CSS selector, which would select content from the source (where the directive was used) and stick it into the appropriate place in the template. For instance:

<!-- foo directive usage -->
<foo>
  <p>Regular content goes here.</p>
  <foo-footer>
    <p>I show up in the footer.</p>
  </foo-footer>
</foo>
<!-- foo directive template -->
<div class="foo">
  <div class="foo-body" ng-transclude />
  <div class="foo-footer" ng-transclude="foo-footer" />
</div>
<!-- foo directive dom (after rendering) -->
<div class="foo">
  <div class="foo-body">
    <p>Regular content goes here.</p>
  </div>
  <div class="foo-footer">
    <p>I show up in the footer.</p>
  </div>
</div>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions