added a max recursion limit (9 levels) since angular throws an error after 10 digest cycles