How can assign value to ng-init with conditional expression?

309 Views Asked by At

I want to assign variable in ng-init with conditional expression but it's not working with my code. I need to assign isCollapsed value true false with conditional expression.

<a class="email" ng-init="isCollapsed = (emailData.length>0?'true':'false')"></a>
1

There are 1 best solutions below

0
piedpiper On

try this -

<div ng-init=" isCollapsed = ( emailData.length>10 ) ? true : false">