Several javascript API functions call depricated $apply and cause errors