Check $$phase prior to $apply to avoid "$digest already in progress" errors.