Skip to content

Commit

Permalink
fix(TranslatePipe): more robust when keys are falsy
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickadam authored and ocombe committed Mar 19, 2016
1 parent 13eea25 commit 28eda37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bundles/ng2-translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/translate.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 28eda37

Please sign in to comment.