Aitor Aitor - 1 year ago 256
AngularJS Question

Concatenate string on repeater with Angular Translate

I want to concatenate a string on a repeater using Angular Translate inside "small" tag to put a description. What i must do?

<li ng-repeat="subtype in type">
<input type="radio" name="radioType" ng-value="subtype" ng-model="dialogModel.type">
{{ }} <small>{{ ' + "_DESCRIPTION"' | translate }}</small>

Now it shows me a literal string, I don't know how concatenate an Angular Translate string.

Answer Source

If + "_DESCRIPTION is the string you want to translate on, the outter ' is not needed.

{{ }} <small>{{ ( + "_DESCRIPTION") | translate }}</small>

btw, if you have many many subtype to repeat, the translate may cause a performance problem , so try to use $filter('translate') in ctrl or simply use one-time binding with "::", it seems that you need not to update the _DESCRIPTION again after it rendered in your case.

{{ }} <small>{{ ::( + "_DESCRIPTION") | translate }}</small>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download