Gianluca Ghettini Gianluca Ghettini - 4 months ago 10
AngularJS Question

Converting a style into ng-style

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

style
which contains angular variables into
ng-style
tags

This is what I've got:

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


how to convert it into an
ng-style
?

I tried converting it like this:

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


but it doesn't work

EDIT

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

Answer

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"
}