【问题标题】:How to add translation filter to notification of ngAdmin?如何将翻译过滤器添加到 ngAdmin 的通知中?
【发布时间】:2017-04-05 08:28:26
【问题描述】:

我的代码是这样的:

function enableUser(Restangular, $state, notification) {
    ...
    ...
    notification.log(
        {{ "DISABLED_LOG_DISABLE" | translate }},
        { addnCls: 'humane-flatty-success' });
}

我发现它会直接在屏幕上显示{{ "DISABLED_LOG_DISABLE" | translate }},但是当我给它{'DISABLED_LOG_DISABLE': 'Disabled employee'}时我需要的是Disabled employee

【问题讨论】:

    标签: javascript ng-admin angularjs


    【解决方案1】:

    此表达式用于 HTML 文件“{{ "DISABLED_LOG_DISABLE" | translate }" 你应该做的是注入 $translate 然后你调用它。例如:

    $translate('DISABLED_LOG_DISABLE').then(function(translatedString) {...})
    

    我猜你正在使用角度翻译。

    【讨论】:

      猜你喜欢
      • 2018-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-24
      • 2014-01-07
      • 2018-09-25
      相关资源
      最近更新 更多