Ionic 2 Shrinking Header on Scroll

I found this code to do a shrinking header on scroll in Ionic 2, but it has some errors.

Does anyone know where to find a solution to this or how to do it in Ionic 2?

Thanks!