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

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

Closed
1 of 3 tasks
fsmeier opened this issue May 23, 2018 · 1 comment
Closed
1 of 3 tasks

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

fsmeier opened this issue May 23, 2018 · 1 comment

Comments

@fsmeier
Copy link

fsmeier commented May 23, 2018

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

@gkalpak gkalpak added this to the 1.7.x - won't fix milestone Sep 26, 2018
@Narretz
Copy link
Contributor

Narretz commented Jan 21, 2019

We are not going to make this property public, but since we are in LTS mode, it won't be removed or changed either, so you can basically use it safely.

@Narretz Narretz closed this as completed Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants