Issue with angular translation in custom filter
NickName:robin Ask DateTime:2017-02-06T16:35:18

Issue with angular translation in custom filter

I am trying to create a filter for showing the elapsed date and time in angular js and is working fine. Now I am trying to add translation to it but that time its showing the keys instead of the values.I think the issue is because the translation is not loaded while the filter is executing.

I am trying translation in the code like

 if(hours){
                    result+= " "+hours+$translate.instant("elapsedFull.hours");
                }
                if(minutes){
                    result+= " "+minutes+$translate.instant("elapsedFull.minutes");
                }
                if(seconds){
                    result+= " "+seconds+$translate.instant("elapsedFull.seconds");
                }

Please check the plunker link and let me know how can i fix the issue.

Plunker

Copyright Notice:Content Author:「robin」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/42063403/issue-with-angular-translation-in-custom-filter

More about “Issue with angular translation in custom filter” related questions

Issue with angular translation in custom filter

I am trying to create a filter for showing the elapsed date and time in angular js and is working fine. Now I am trying to add translation to it but that time its showing the keys instead of the v...

Show Detail

Angular Js Translation Partial Issue

I am binding translation. The issue is , some object convert to translated value, while some like mentioned below didn't work. This issue happened only first time when I build project. On refresh i...

Show Detail

Angular Translation in JavaScript File

I have followed the Angular translation example and html page translation is working by calling with filter, say {{'TITLE' | xlat}} I want to use the translation in JavaScript file. I tried calling $

Show Detail

angular custom filter issue

I am trying to implement custom filter in angular js. The idea is that user can add some tags and each time filter is invokes. Filter is a plain javascript object, basically it looks like this: var

Show Detail

Default translation value in custom Angular library

I created Angular library and added translation module @ngx-translate/core and added keys for it. It works properly for keys that root application translated. But if root application (application w...

Show Detail

Using $translate in a custom filter

I am making a filter that translates the given key. The filter will translate a value using Drupal.t() if the function exists else it will use The Angular Translate from Pascal Precht. For angular

Show Detail

How to access Angular JS custom filter JSON data in view

I'm developing multi language support Angular JS project. I want to translate label names into a specific language (Label names - search sites, visit site. It is already have values). For this I'm ...

Show Detail

Custom filter in Angular

I have some problem with custom filter. I can't include it's in my project. Firstly I used a filter: text. I understand that array initialized asynchronously and used this custom filter. But when i

Show Detail

angular-translate nested JSON and filter

When using angular-translate I can filter my strings like so: <ANY>{{'TRANSLATION_ID' | translate}}</ANY> It works very well with the following flat JSON: { TRANSLATION_ID: 'A va

Show Detail

How to pass multiple parameter in angular filter function, not custom filter

I tried hard and visit lot of similar question like this but still unable to solve this issue. I want to pass extra parameter in angular filter function. I found solution as below but it's not wor...

Show Detail