Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which performance are better? ngx-translate Directive or Pipe?

I'm using ngx-translate 11.x with angular 7 in a huge project.

When use pipe transform show first empty string And when use directive, show first path to translate string.

Directive way: <span [translate]="HELLO'"></span>

Pipe way: <span >{{'HELLO'| translate}}</span>

Now, Which performance are better?

like image 741
Morteza QorbanAlizade Avatar asked Nov 08 '22 00:11

Morteza QorbanAlizade


1 Answers

There is the official i18n module for performances.
Also with ngx-translate you can write something like this: <span [innerHtml]="'HELLO'" translate></span>

like image 118
Marc Avatar answered Nov 15 '22 06:11

Marc