bra*_*r19 2 javascript translate angularjs
在我的应用程序中,我尝试连接两个字符串:电子邮件和一些文本.
但我有一个麻烦,我需要文本部分可以"动态"翻译,所以我写道:
$scope.textUnsubscribe = 'SUCESSFULL_UNSUBSCRIBE';
Run Code Online (Sandbox Code Playgroud)
在视图中:
<h4 ng-bind-html="textUnsubscribe | translate"></h4>
Run Code Online (Sandbox Code Playgroud)
我敢肯定(电子邮件+文字):
<h4 ng-bind-html="userEmail"></h4>
<h4 ng-bind-html="textUnsubscribe | translate"></h4>
Run Code Online (Sandbox Code Playgroud)
但后来我有风格错误......
我可以以某种方式放入一个ng-bind-html两个范围变量?一个是"静态的",第二个是可翻译的?
喜欢:
<h4 ng-bind-html="userEmail, (textUnsubscribe | translate)"></h4>
Run Code Online (Sandbox Code Playgroud)
如果它只是简单的字符串,如电子邮件.你不需要ng-bind-html,ng-bind就够了.添加-html使ng-bind更安全更小.无论如何ng-bind可以多次使用.如果你有一个"风格错误",它来自你的HTML(你有多个h4).
无论如何,你可以这样简单地做到这ng-bind一点:
<h4 ng-bind="userEmail +' '+ (textUnsubscribe | translate)"></h4>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6639 次 |
| 最近记录: |