I'm looking for a way to use existing dome nodes of component as it's template. transclusion is the closest I what I ended up with, but it still requires additional wrapping elemwe
app.component('widgetDom', {
controller: function ($scope) {
$scope.data = "I'm data for nested dom elements";
}
});
And then display it as
<widget-dom>{{data}}</widget-dom>
But it won't work.
With transclusion I would end up with:
<widget-dom><div ng-transclude>{{data}}</div></widget-dom>
Is there a way to just use nested DOM elements as template for component/directive?
Thank you.
templateortemplateUrl. If you want to use parentScope data you can send it with binding.compilefunction and compiled with $compile against current scope. Components aren't supposed to work that way, and if you care about further upgrade to Angular 2+, it will certainly have problems with such approach.