From 28eda3753151d2567b54c468edf76c9613390bc8 Mon Sep 17 00:00:00 2001 From: Yannick Adam Date: Fri, 18 Mar 2016 00:55:08 +0100 Subject: [PATCH] fix(TranslatePipe): more robust when keys are falsy --- bundles/ng2-translate.js | 2 +- src/translate.pipe.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/ng2-translate.js b/bundles/ng2-translate.js index 45dca6f9..1857182d 100644 --- a/bundles/ng2-translate.js +++ b/bundles/ng2-translate.js @@ -82,7 +82,7 @@ System.registerDynamic("src/translate.pipe", ["angular2/core", "./translate.serv }; TranslatePipe.prototype.transform = function(query, args) { var _this = this; - if (query.length === 0) { + if (!query || query.length === 0) { return query; } if (this.equals(query, this.lastKey) && this.equals(args, this.lastParams)) { diff --git a/src/translate.pipe.ts b/src/translate.pipe.ts index bf80466a..8bda86bf 100644 --- a/src/translate.pipe.ts +++ b/src/translate.pipe.ts @@ -76,7 +76,7 @@ export class TranslatePipe implements PipeTransform, OnDestroy { } transform(query: string, args: any[]): any { - if(query.length === 0) { + if(!query || query.length === 0) { return query; } // if we ask another time for the same key, return the last value