Angular 2 custom pipe for age and raw address

on with Leave a reply

I was recently working on the angular 2 custom pipe. I created couple of custom pipe to serve different purpose. So I thought it will be useful for others, because I think this is very common for most of us

  1. Age PIPE
  2. Full Address PIPE

1. Age Pipe

Age pipe is very simple if you give date of birth of user. It will convert to age in years using moment js.

Example : {{ ‘1988-10-31’ | age }}

2. Full Address PIPE

In most cases, We will store address in database as separate fields, but when it comes to visualization in app, we need to display as full raw address from object. So this pipe will help us to transform object to raw address.

Example : {{ addressObject | fullAddress}}

 

Thanks, hope it helps someone

 

Posted in Cocktail and tagged , , by .

About Gowri

I am professional web developer with 4+ years experience. PHP, jQuery, WordPress, Magento and Symfony2 are my key skills in web development. I am working with strong enthusiastic team with spirit. We provide all web related solution like HTML/CSS development, Web graphic design and Logo.

Leave a Reply

Your email address will not be published. Required fields are marked *