Nested quotes in an Angular expression

In .js files, triple enclosed quotes ("one'two" three "'") can be escaped ( see this post ), and in HTML this can also be achieved using character references ( see this post ). I have a problem with achieving this in an AngularJS expression in my template.

I need to put this:

{{ 'PLURAL' | translate:"{ GENDER: 'male' }":"messageformat" }}

To placeholder:

<input placeholder="{{ 'PLURAL' | translate:"{ GENDER: 'male' }":"messageformat" }}">

How do I escape quotes to make it work?

+4
source share
2 answers

{ GENDER: 'male' } , , .

<div ng-init="maleFilter = { GENDER: 'male' }">
   <input ng-attr-placeholder="{{ 'PLURAL' | translate: maleFilter : 'messageformat' }}">
<div>

, , .

+4

. Angular docs .

, :

placeholder="{{ 'PLURAL' | translate:{gender:'male'}:'messageformat' }}"
+1

All Articles