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?

2
  • Use ng-magic wand to convert them. Commented Aug 4, 2017 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 Commented Aug 10, 2017 at 22:53

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.