Sunday, 15 April 2012

javascript - how to setup the class name in my case -


I am trying to combine the NG-class condition statement in my case.

I have the following statement.

  & lt; Div ng-class = "item.new? New itam ':' oldname ';' Discount ': item.getType === true & amp; amp; item.getSave === true "& gt; {{Item.name}} & lt; / Div & gt;  

I'm getting the parsing error

  Syntax error: token ': is an unexpected  

I'm not sure Is that how to fix this? Can someone help me about this?

ng-class = "{new item: item.NEW, old item: iitat.New, discount: items .get type === true & item. < / Code>

Or optionally put your argument in a function:

  
ng-class = "getclasses (item)" & gt;

and in your controller:

  $ scope.getClasses = function (item) {return {newItem: item.new, oldItem: item.new, Discount: item.getType === true & amp; amp; item.getSave === true};}  

FYI: that function lets you create an array of objects or strings back


No comments:

Post a Comment