I encountered an issue while attempting to set values in AngularJS UI grid based on the row.entity values. To address this, I created a cellTemplate that evaluates the row values and applies text styling accordingly.
Code Snippet
var statusTemplate='<div>
<span class="txt-color-yellow" ng-if=row.entity.status.name=="Draft">{{row.entity.status.name}}</span>
<span class="txt-color-orange" ng-if=row.entity.status.name==[
"AwaitingReview"]>{{row.entity.status.name}} </span><span
class="txt-color-green" ng-if=row.entity.status.name=="Reviewed">{{row.entity.status.name}}
</span><span class="txt-color-blue" ng-if=row.entity.status.name==[ "Ready ForScripting"]>{{row.entity.status.name}}</span><span
class="txt-color-brown" ng-if=row.entity.status.name==[ "Awating
ScriptReview"]>{{row.entity.status.name}}</span><span
class="txt-color-green" ng-if=row.entity.status.name==[ "ScriptReviewed"]>{{row.entity.status.name}}</span><span
class="txt-color-green" ng-if=row.entity.status.name=="Closed">{{row.entity.status.name}}</span>
';
However, I faced a challenge with ng-if
when attempting to compare text values containing spaces. This resulted in an exception mentioning
Unterminated quote at columns 25-34 ["Awaiting] in expression [row.entity.status.name==["Awaiting]. etc...
.
If you have any suggestions on how to handle text comparison with spaces in ng-if, please share them.