问题描述
home.directive('content',function(){
return { restrict:'E', templateUrl:''} });
问题解答
回答1:templateUrl可以返回一个函数:
home.directive(’componentA’, function() { return { restrict: ’E’, link: function(scope, element, attrs) { // }, templateUrl: function(elem,attrs) { return attrs.templateUrl || ’./default.html’ } }});