javascript - Kendo UI Grid and ng-style -


i have kendo ui grid in angular reading datasource series of properties. 1 of them contains color string. want use said color string set background-color square-box in grid.

i'm using following template box:

template: "<img class='alarm-box-prediction variable' ng-style={'background-color': dataitem.type}'></img>" 

the relevant data datasource following:

datasource: {         datasource: function(data) {             // map stored properties in data array of objects received              // corresponding columns in grid             return $.map(data, function(alarmproperty) {                 return {                     // change array index match api once getting data there                     type: alarmproperty[0],                     //... there more properties here removed them not focus                 };             });         }, 

the data relevant json file serving ds (will changed though) is:

{     "alarms": [         {             "type": "yellow", //...         } //... ]} 

found out issue. ng-style needs formatted differently because being passed string kendo.

template: "<img class='alarm-box-prediction variable' ng-style=\"{'background-color':dataitem.type}\"></img>", 

Comments