They are oppositely charged ions and will be electrostatically attracted to one another. This electrostatic attraction is an ionic bond. Sodium chloride (NaCl) then represents ionic compound because it is held intact by ionic bond. Another example is magnesium oxide; magnesium transfers its covalent electrons to oxygen forming the magnesium ion and an oxide ion. Then, the resulting ion is electrostatically attracted to one another forming an ionic bond.
Calcium loses two electrons to form a calcium ion, one of these electrons is transferred to chlorine atom and another is transferred to another chlorine atom forming two chloride ions. The calcium ion is electrostatically attracted to the two chloride ions because the opposite charges must fully balance each other up in all three examples, the resulting ionic compound have an overall neutral charges because all charges are full balance out. In summary an ionic bond is defined as the electrostatic attraction between oppositely charged ions, when an ionic compound is formed the charges must be balance so that the resulting ionic compound has an overall neutral charge.
As with metals there are variations in the properties of individual ionic compounds, but some generalisations can be made about the physical properties characteristic of ionic compounds. Ionic compounds have high melting and boiling points and are all solids at room temperature. They are made up of hard crystals and they are neither malleable nor ductile, but are brittle. In the solid state they are non-conductors of electricity but they are good conductors of electricity in the liquid state. The solutions formed from soluble ionic compounds are good conductors of electricity. Their solubilities in water vary from very soluble to insoluble. They are not soluble in non-polar solvents, such as oil. Ionic solids formed from group 1 and 2 metals are white or colourless while those formed from transition metals are usually coloured.