How can I transclude into an attribute?

Viewed 11141

Is is possible to somehow use ngTransclude for an attribute value, instead of replacing inner HTML content? For example this simple directive

var testapp = angular.module('testapp', [])

testapp.directive('tag', function() {
  return {
    template: '<h1><a href="{{transcludeHere}}" ng-transclude></a></h1>',
    restrict: 'E',
    transclude: true
  }
});

and use it as

<tag>foo</tag>

I want it to translate into

<h1><a href="foo">foo</a></h1>

Is there any way of doing that, or do I have to use an attribute instead of transcluding?

Here's a fiddle with the example

4 Answers
Related