0

I have following directive like "pulsate" with restrict option class. I need to write condition like as below.

<div class="{pulsate : $index === 2}">

I tried this but its not working fine. So please help any one.

Jax
  • 1,839
  • 3
  • 18
  • 30

2 Answers2

1

You need to use ng-class directive in order to achieve the solution.

<div ng-class="{pulsate : $index === 2}"> 
Nikhil Aggarwal
  • 28,197
  • 4
  • 43
  • 59
  • 1
    Yes, you need to add quotes around pulsate for angular to distinguish plain text from text with special meaning like directives. – Nikhil Aggarwal Jun 05 '15 at 12:51
0

Use single commas around your class name like so:

<div ng-class="{'pulsate' : $index === 2}">
Jax
  • 1,839
  • 3
  • 18
  • 30