Is is possible to somehow use ngTransclude for an attribute value, instead of replacing inner HTML content? For example this simple directive
va
I know originally your question was about transclusion, but this problem is MUCH more succinctly solved using an attribute.
var testapp = angular.module('testapp', [])
testapp.directive('tag', function() {
return {
template: '{{url}}
',
restrict: 'E',
scope: {
url: '@'
}
}
});
and your html
The translation:
foo
Also, with the very latest version of Angular, there is a feature called "one-time binding" that is perfect for situations just like this where you only want/need to fulfill the interpolated value one time, upon initialization. The syntax looks like this:
{{::url}}
Just replace all instances of {{url}} in your template with the above.