ng-include
is like a tool for inserting content easily. Unfortunately, it doesn't have the functionality to achieve what we want directly. An alternative approach would be to create a directive and use a scope variable such as sub-style
within the directive to set internal styles.
This is how you would call it:
<span class="svgcont2"
icon-url="menuItem.iconurl"
fill-info="getFill($index)"></span>
The directive implementation:
app
.directive('svgcont2', function() {
return {
restrict: 'C',
scope: {
fillInfo: '='
},
templateUrl: function(elem, attrs) {
return attrs.iconUrl
}
};
});
In your directive template:
<svg style="{fill: fillInfo}">
Another method is to utilize styles. If your styling needs are uncomplicated, you can apply additional classes to the parent span element and pass them down to the children elements. Here's a brief example:
.svgcont2.fill div.childelement
{
//Your style here
}