Hsw
Hsw

Reputation: 37

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'}

Upvotes: 2

Views: 77

Answers (1)

Ramy Rais
Ramy Rais

Reputation: 140

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.

Upvotes: 1

Related Questions