angularjs – 如何转换成属性?

是否可能以某种方式使用ngTransclude作为属性值,而不是替换内部的HTML内容?例如这个简单的指令
var testapp = angular.module('testapp',[])

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

并使用它

<tag>foo</tag>

我想把它翻译成

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

有什么办法做,或者我必须使用属性而不是转录?

这里有一个fiddle的例子

这样的东西:
var testapp = angular.module('testapp',function() {
  return {
    restrict: 'E',template: '<h1><a href="{{transcluded_content}}">{{transcluded_content}}</a></h1>',replace: true,transclude: true,compile: function compile(tElement,tAttrs,transclude) {
        return {
            pre: function(scope) {
                transclude(scope,function(clone) {
                  scope.transcluded_content = clone[0].textContent;
                });
            }
        }
    }
  }
});​

fiddle

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...