javascriptng-adminangularjs

How to add translation filter to notification of ngAdmin?


My code is like this:

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

I found that it will display {{ "DISABLED_LOG_DISABLE" | translate }} directly to the screen but what I need is Disabled employee when I give it {'DISABLED_LOG_DISABLE': 'Disabled employee'}


Solution

  • This expression is used in HTML file "{{ "DISABLED_LOG_DISABLE" | translate }" What you should do is inject $translate and then you call it. For example:

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

    I guess you are using angular-translate.