In theory digital should offer advantages, but until recently that has not always been the case- until very recently compass chips small and cheap enough for diving gear were not all that accurate or easy to calibrate. That gave digital compasses kind of a bad rap. But this technology has been changing.
The latest generation digital compass chips are very good, and have the advantage of working in any orientation, upside-down, sideways, whatever. That is, assuming the device is designed to take advantage of that capability. This kind of device- which is also necessarily tied to an accelerometer- has been improving by leaps and bounds in the last couple of years, mostly driven by the smart phone market. So it really depends.
You don't say if you are interested in some kind of standalone compass or are asking about compasses integrated into dive computers. If the latter, there is a lot of variation in the way the interface is handled. Does the compass require going to another screen, or can you still see your dive data while using it? Can you set bearings and navigation markers? Is it fully tilt compensated, or do you need to hold it somewhat level, like an analog compass? How easy/ hard is it to calibrate? There is a lot more variation in digital compasses than in analog ones, and the technology has evolved a great deal, so it's hard to give an overall judgement.
As Richard says, we have been on the front lines with digital compasses in the Cobalt, and the latest generation is night and day in performance.
Ron