Using JSON.stringify in an expression in Angular2 template : <p>I have a small expression to check whether 2 objects are different or not, in order to display this element (via adding class name):</p>

<pre><code>&lt;div ngClass='{{JSON.stringify(obj1) != JSON.stringify(obj2) ? "div-show" : ""}}'&gt;&lt;/div&gt;
</code></pre>

<p>The problem is I get this error: 
<code>Cannot read property 'stringify' of undefined</code>.</p>

<p>What I need a way to work around, or a proper solution if available. Thanks.</p>

<p>PS: I use JSON.stringify() to compare 2 simple objects, nothing fancy here.</p>
