Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set title attribute with condition and using angular translate

I am using title attribute with some condition and my code is

<li title="{{admin ? 'purchase license pack':''}}"><span translate>pack.details</span></li>

Here when the admin is true then it shows purchase license pack. But how to make that one to i18n keys by using translate filter. I tried this,

<li title="{{admin ? '{{'purchase.pack'|translate}}':''}}"><span translate>pack.details</span></li>

But It shows parsing error. How to do this?

like image 204
VijayVishnu Avatar asked Oct 23 '15 05:10

VijayVishnu


1 Answers

The error was natural since you were trying to interpolate the interpolation. However, You were quite close.. Try This :

<li title="{{admin ? ('purchase.pack'|translate) : ''}}"><span translate>pack.details</span></li>
like image 147
Manish Kr. Shukla Avatar answered Nov 03 '22 23:11

Manish Kr. Shukla