I didn't want the directive to care what the attribute name was, so this is what I ended up doing:
test
app.directive('sharedAsset', function (globalVars) {
return {
restrict: "A",
scope: {
attr: "@attr"
},
link: function (scope, element, attrs) {
var fullPath = globalVars.staticWebsite + "/app/styles/main/" + attrs.sharedAsset + "?build=" + globalVars.buildNumber;
attrs.$set(scope.attr || "src", fullPath);
}
};
});
Update: I changed it to default to the "src" attribute since images will be the most common scenario.