Assign classes conditionally in Angular2
<p>I'm trying to conditionally assign a class to a div based on the value I obtained from my back-end system.</p>

<p>Say there is an object <code>'A'</code> which has a variable <code>status</code> which possibly has values <code>status1</code> and <code>status2</code>.</p>

<p>I'm trying to assign 2 classes (<code>class1</code> and <code>class2</code>) conditionally depending on the status using Angular 2. Following is the condition I'm using. Please suggest a working alternative for this,</p>

<pre><code>&lt;div ng-class="{status1 : 'class1', status2 : 'class2'}[A.status]"&gt;
   ...
&lt;/div&gt;
</code></pre>