Is there a way to get transclude content after it has been interpolated using $transclude in a controller? I want the transclude to be performed without any alteration, but I need the interpolated value.
For example I have a component that transcludes an interpolated string:
<my-transclude-component>{{ vm.someTextToTransclude }}</my-transclude-component>
Using $transclude
in my controller I can do this to get the transcluded content, but it gives the uninterpolated value of {{ vm.someTextToTransclude }}
as a string instead of Hello World
:
vm.$onInit = function() {
$transclude(function(clone) {
console.log(clone.text());
});
}
I know I can bind it to the component, but that's not the point of this question. Currently this is how it is being done since the content isn't interpolated using $transclude:
<my-transclude-component my-text="{{ vm.someTextToTransclude }}"></my-transclude-component>