var directive = {
link: link,
templateUrl:
function (element, attrs) {
return attrs.templateUrl ? attrs.templateUrl : '/assets/svg/test.svg';
},
restrict: 'EA',
transclude: true
};
return {
template: '<ng-include src="templateUrl"></ng-include>',
scope: {},
link: function (scope, el, attr) {
attr.templateUrl.$observe(); // логика изменения переменной.
}
}