From http://plnkr.co/edit/LCMG2vqUtlgtbw6dZahh?p=preview