Chexpir
Chexpir

Reputation: 1876

How to escape a filter variable in AngularJS?

I want to escape the single quotes in the unique filter in angular but I can't, I've tried it in the following ways. If the field wouldn't have a hyphen I could do attrbutes.displayname and it will work (I've tried it), but I have a hyphen...

Example:

<select ng-model="style" ng-options="block.attributes['display-name'] for (blockName, block) in styleBlocks | unique:'attributes[\'display-name\']'">

<select ng-model="style" ng-options="block.attributes['display-name'] for (blockName, block) in styleBlocks | unique:'attributes[\\'display-name\\']'">

Upvotes: 1

Views: 289

Answers (1)

Related Questions