Uses $apply to evaluate passed in function