Before a sodium atom and a chlorine atom combine together to form the ionic compound $$NaCl$$, they are just neutral atoms. However, when an electron is transferred from the outer energy level of the sodium atom to the chlorine atom, both of these gain a charge on them; the sodium atom or ion has a charge of $$1+$$ and the chlorine ion has a charge of $$1-$$. Both of these ions attract each other and an ionic bond is formed between them.
But what happens when an atom of an element say $$Ca$$ combines with a polyatomic ion say $$OH^-$$. Is this calcium atom an ion, is it already a charged atom when it interacts with the hydroxide ion or does it gain the charge by any transfer of electrons to the $$OH^-$$ ion and becomes $$Ca^{2+}$$ to bond with the $$OH^-$$ ion?
I think the polyatomic ions say $$OH^-$$ is already an ion and not an uncharged compound of elements that gains charge as in the case of $$NaCl$$, and the bond between an ion and a polyatomic ion is due to the attractive forces between them if already they have opposite charges.