Ionic compounds are formed between a positive ion and a negative ion. These ions have opposite charges, creating an electrochemical attraction similar to the opposite ends of magnets having an attraction.
There are two types of ionic compounds. The first is created when a positive metal cation is attracted to a negative non-metal anion.
When the charges of these ions are equal and opposite the atoms will bond
A sodium cation
to form a NaCl salt molecule of sodium chloride.
In the case of a calcium cation
The other form of ionic bond takes place between a positive metal cation and a polyatomic ion composed of more than one type of atom.
I hope this was helpful.