AngularJS Translate: How to handle form text with link?

I am using Angular Translate to translate my webapp. I can translate some label, phrase, but when I want to translate a phrase containing a link. The text is displayed raw. I want to show a checkbox:

My json file:

 "cgu":"Accept <a href=\"#/ourconditions\"> our Terms and conditions</a>"

      

My checkbox in the form:

        <div class="form-group">
        <div class="">
        <label for="cgu">
                <input type="checkbox" id="cgu" ng-model="cgu" checked>
                {{"global.form.cgu" | translate}}
                <div ng-bind-html-unsafe="global.form.cgu | translate"></div>
            </label>
        </div>
        </div>

      

Here's what's displayed: raw text, not a link: enter image description here

I tried solution: postoverflow post 1

and this Nothing works.

+3


source to share


1 answer


You need to tell angular translate to compile the translated string (s. " Publish compilation " on the main angular translation page) ..



<span translate="{{ global.form.cgu }}" translate-compile></span>

      

+3


source







All Articles