Gianluca Ghettini Gianluca Ghettini - 1 year ago 48
AngularJS Question

Converting a style into ng-style

My AngularJS app doesn't work on IE11. I learnt I need to convert every inline

which contains angular variables into

This is what I've got:

<div id="mydiv" style="color: {{ ::channel.colour }};"></div>

how to convert it into an

I tried converting it like this:

<div id="mydiv" ng-style="color: {{ ::channel.colour }};"></div>

but it doesn't work


General issue:
Manipulating inline style with angular does not work in IE

Answer Source

seems to be scope variable is not binding to style or ng-style. you need to try something like

<div id="mydiv" ng-style="colour"></div>

And in controller

$scope.colour= {
  "color": "red"