angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Empty scope spans created by ng-transclude

Open ghost opened this issue 14 years ago • 8 comments

Please read this:

https://groups.google.com/forum/?fromgroups=#!topic/angular/5SaF085FANw

Bottom line is that ng-transclude in directive templates creates spans with class="ng-scope" which breaks the layout.

ghost avatar Aug 26 '12 03:08 ghost

Same as #1059, I think.

symblify avatar Aug 26 '12 13:08 symblify

fixed by https://github.com/jamessharp/angular.js/commit/0196bc871a7404173e21f59c77ab63f1d3a92091

@petebacondarwin

see http://plnkr.co/edit/xR4N5chhFyAvNubCJKJD?p=preview

Narretz avatar Jan 12 '14 20:01 Narretz

It seems that ng-trasnclude is adding spans again in Angular 1.5.8. Works fine in 1.5.7

piotrppe avatar Oct 06 '16 12:10 piotrppe

@stefanFruuu, can you provide a reproduction (e.g. a live demo using CodePen, Plnkr etc)?

gkalpak avatar Oct 06 '16 12:10 gkalpak

@gkalpak https://plnkr.co/edit/YRqaDYsdRJUotYwgntqV image

piotrppe avatar Oct 06 '16 13:10 piotrppe

  1. in case of 'simple' transclude ('transclude': true - plnkr above) spans are added in both 1.5.8 and 1.5.7

  2. in case of multi-slot transclude with optional slot and default value spans are not added in 1.5.7 (https://plnkr.co/edit/kQhXKe0qA4Kg5aZ4zLVQ, image )

    but are added in 1.5.8 ( https://plnkr.co/edit/NiJOif6IEbZhWAhhNHZt image )

piotrppe avatar Oct 06 '16 14:10 piotrppe

@stefanFruuu, indeed there is a difference. It has been introduced in 1.5.8 by 159a68e.

Previously, any fallback content was compiled as part of the parent template (even if that content would not be used). With 159a68e the fallback content will be compiled separately and only if necessary. A side effect of this separate compilation is that the fallback content is now treated as a template root and root text nodes are wrapped in <span>.

In 1.6.x there will be no extra <span> whatsoever, but this change is indeed undesirable for 1.5.x 😞 We'll look into it.

@stefanFruuu, could you create a separate issue to track that regression?

gkalpak avatar Oct 06 '16 15:10 gkalpak

Thanks for explanation! I've created new issue: https://github.com/angular/angular.js/issues/15223

piotrppe avatar Oct 06 '16 18:10 piotrppe