angular-vs-repeat icon indicating copy to clipboard operation
angular-vs-repeat copied to clipboard

Add support of ng-transclude

Open arthud opened this issue 7 years ago • 4 comments

Fix ng-transclude in ng-repeat gives exception: Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found

arthud avatar Mar 29 '17 12:03 arthud

That's really nice! Is this going to be merged soon? That's exactly what is needed for my project as well.

arrigod avatar Oct 18 '17 07:10 arrigod

What's the example usage here?

kamilkp avatar Mar 20 '18 04:03 kamilkp

@kamilkp Use case is very simple nested angular components. Would be nice to have it released.

falsyvalues avatar Nov 07 '18 12:11 falsyvalues

ng-transclude is also used synonymously as web component slots in AngularJS components. My combobox component would have benefited from this as it allows other devs to provide their own markup.

// consumer html
<idk-combobox>
    <idk-combobox-item-slot>Custom</idk-combobox-item-slot>
</idk-combobox>

// component controller
angular.module('app', ['vs-repeat'])
    .controller('appController', ['$scope', '$filter', function($scope, $fiter) {
        // ...
    }])
    .component('idkCombobox', {
        templateUrl: 'idkCombobox.html',
        ...
        transclude: {
            'customItemSlot': '?idkComboboxItemSlot'
        },
        ...
    });

// component template (idkCombobox.html)
<div class="combobox">
    // <div vs-repeat> ...wishful thinking
    <div class="combobox-item" ng-transclude="customItemSlot">
        If customItemSlot exists, I get replaced with its content, otherwise I appear here by default.
    </div>
    // </div>
</div>

kerryj89 avatar May 24 '22 03:05 kerryj89