I am struggling to set the background of an element using a configuration object with ng-style
. For some unknown reason, I can't seem to make it work and I'm finding it really perplexing.
The element I'm attempting to configure:
<div id="progress-l" ng-style="{ 'width': pblc.options.width, 'height': pblc.options.height, 'background': plbc.options.color }"></div>
In this context, pblc
represents the controller as I'm utilizing the controllerAs
option.
The configuration object:
this.progressLOptions = {
color: '#F0F3F4',
width: '200px',
height: '20px',
};
What's most puzzling is that the width and height are being applied, as seen in the rendered HTML:
<div id="progress-l" ng-style="{ 'width': pblc.options.width, 'height': pblc.options.height, 'background': plbc.options.color }" style="width: 200px; height: 20px;">
</div>
I am stumped as to why ng-style
is behaving oddly. Could there be an issue with setting the background color that I am overlooking?