1

I am trying to use col-sm-9 when a flag is set to false, and col-sm-5 when it is set to true. I'm trying this

<div ng-class="{col-sm-9: !flag, col-sm-5: flag" class="col-sm-offset-3}"></div>

I get a $parse:syntax error at the first hyphen after the {. I've tried putting single quotes around the class names as well and continued to get syntax errors. What am I doing wrong? Also, is it ok if I try to apply that additional class at the end no matter what because they both need applied on the same div?

Edit: syntax from me typing this this morning

Zach
  • 640
  • 1
  • 8
  • 20

1 Answers1

2

Try this:-

  <div ng-class="{'col-sm-9': !flag, 'col-sm-5': flag}" class="col-sm-offset-3"><\div>
Manish Balodia
  • 1,863
  • 2
  • 23
  • 37