1

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Raghu
  • 699
  • 7
  • 14
  • Use ng-magic wand to convert them. – rtn Aug 04 '17 at 13:05
  • @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. Thanks – Raghu Aug 10 '17 at 22:53

1 Answers1

1

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.