added example, fixed bug with $digest loop