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.

Allow multi transclude directives like ngIf - expose $$tlb #16574

@fsmeier

Description

@fsmeier

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:
If I want to create an ngIf-like directive I have to use a private property $$tlb. But ngIf-like directives are sometimes needed and there are used already by many developers.
Example:

module.directive('customIf', ['$animate', function($animate) {
            return {
                multiElement: true,
                transclude: 'element',
                priority: 100,
                terminal: true,
                restrict: 'A',
                $$tlb: true,
                link: function($scope, $element, $attr, $ctrl, $transclude) {
                    var $unWatch,
                        clonedElem,
                        childScope
                    ;

                    $scope.$on('$destroy', function() {
                        if ($unWatch instanceof Function) {
                            $unWatch();
                        }
                    });

                    $unWatch = $scope.$watch($attr.customIf, function customIfWatchAction(value) {
                        [...]
                    });
                }
            }
        }]);

Expected / new behavior:
$$tlb should be official introduces so nobody has to fear the removal since it is atm private and actually should not be used by any custom directives. As far as I know by my google research multi-transclusion is possible now, but still it is not possible to make a directive like the ngIf without multElement=true & $$tlb=true

AngularJS version: 1.5.x, 1.6.x

Browser: [all]

Anything else:
It is told to not use $$tlb but no alternative is given: #6042
Already asked here with many many comments and somehow implemented partly but asked to open new issue instead of using closed one: #4357

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions