6

I have a simple directive with transclusion slots.

function wmFormControl() {
    return {
        replace: true,
        templateUrl: 'wm-form-control.htm',
        transclude: {
            label: '?label',
            hint: '?hint'
        }
    };
}

and template

<section>
    <span ng-transclude="label"></span>
    <div ng-transclude></div>
    <span ng-transclude="hint"></span>
</section>

this is a usage

<wm-form-control>
    <label>Label</label>
    Blah blah blah
    <hint>hint</hint>
</wm-form-control>

As a result I have:

<section>
    <span ng-transclude="label">
        <label>Label</label>
    </span>
    <div ng-transclude>
         Blah blah blah
    </div>
    <span ng-transclude="hint">
        <hint>hint</hint>
    </span>
</section>

Is there any way to remove slot wrappers? <label> and <hint> or the one with ng-transclude, for example?

What I want to get:

<section>
    <span ng-transclude="label">Label</span>
    <div ng-transclude>
         Blah blah blah
    </div>
    <span ng-transclude="hint">hint</span>
</section>
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Kindzoku
  • 1,368
  • 1
  • 10
  • 29

0 Answers0