angular / angular.js

AngularJS - HTML enhanced for web apps!
https://angularjs.org
MIT License
58.84k stars 27.52k forks source link

Dynamically change from one named transclusion slot to another #15082

Open onlywei opened 8 years ago

onlywei commented 8 years ago

Do you want to request a feature or report a bug? Feature

What is the current behavior? When using ngTransclude like so:

<div ng-transclude="{{expressionThatMayChange}}"> ... </div>

The expression changes in the DOM, but the ng-transclude directive does not react.

What is the expected behavior? I would like for the contents of the above div to change to the content of the new named transclusion slot.

What is the motivation / use case for changing the behavior? This simplifies (in my opinion) the API and allows the user to avoid creating extraneous DOM elements with ng-if or ng-switch just for selecting transclusion slot.

Which versions of Angular, and which browser / OS are affected by this issue? 1.5.x

I would be happy to attempt a pull request for this feature if no reason to avoid doing so is presented.

gkalpak commented 8 years ago

Interesting feature. It would be nice to have, but I am afraid it will be a pain to get right (covering all corner cases etc) and maintain :confused: