I am trying to change the attribute that is passed in to the third party directive md-icon.
I tried by delegating, but the value does not change.
So far this is what I have.
angular.module('app').decorator('mdIconDirective', function ($delegate) {
let directive = $delegate[0];
let compile = directive.compile;
directive.compile = function(el, attrs) {
let link = compile.apply(this, arguments);
return function(scope, el, attrs) {
let src = `node_modules/@mdi/svg/svg/${attrs.mdSvgSrc}.svg`;
el[0].setAttribute('mdSvgSrc', src);
link.apply(this, arguments)
};
};
return $delegate;
});
I want to change the value passed in md-svg-src so that I don't have to write the full path every time.