change to $apply intead $digest