1
votes

I am using an hybrid angular app where Angular 1 application runs inside an Angular 4 app. All new components are being developed in Angular 4. However since we have a huge amount of legacy code in Angular 1, I would like to reuse some of the Angularjs filters in Angular 4 components. We have a huge number of filters to deal with Internationalization (date formats, number formats, language, etc with user profile preferences).

Is there a way to upgrade the Angularjs filters as Angular 4 pipes and reuse them in Angular 4 html templates?

1
Use ng-magic wand to convert them.rtn
@runyards, Thanks for your response, but can you provide further details such as a link? I can't find enough information on ng-magic. All i get is a broken link to sourceforge.net. ThanksRaghu

1 Answers

1
votes

According to the official Angular upgrade guide (see https://angular.io/guide/upgrade#add-the-checkmarkpipe), there is no ready-to-use support for upgrading NG1 filters to NG2+ pipes. You have to write the pipes yourself, but for most of the cases this is not so complicated.
Note that there are a few built-in internationalization (i18n) pipes in Angular (date, number, currency, percent), and with Angular5, they were completely rewritten (see https://blog.ninja-squad.com/2017/11/02/what-is-new-angular-5/), causing some breaking changes.