In classical e&m, for gauge invariance you can choose div[A]=0 or div[A]=dV/dt, where A is vector potential and V is the scalar potential; however, in qft you multiply your wavefunction by a phase factor that is dependent on space time. My question is that is there any parallel that can be drawn between these two different processes, if there is then I am not seeing it. I mean I can understand there may be the difference between the fact that one is for a classical picture of a field and the other in a quantum sense. Also I am having a hard time really understand how attaching a phase factor dependent on spacetime can really lead to the feynman rules for interaction terms or in the sense what it really does (like how are you able to understand that doing this gives a mathematical description of how particles couple with the gauge bosons), (I do understand that the equations should be invariant under this transformation). In the event that there is no connection between these two different ways of expressing gauge invariance, why do they differ (but I still think that they are connected somehow). Thanks in advance to whoever answers this post.