Car stops running when idling and then there is no electrical power?

When your car slows to idle the output of electricity drops and if the battery does not hold a charge then the car can stop running and not start and the lights and radio will dim fast and there is some electric. If all electric stops then the battery may not be connected and the only way to start is by jumper to the wires at the top of the battery. There may be a corroded connection at the top of the battery, so clean the battery connections. Other connections come from the voltage regulator which can be replaced for about 15 US dollars.