An ionic bond is formed when an element completely transfers its valence electron to another element. The element which donates the electron is known as electropositive element and forms a positively charged ion called as cation. The element which accepts the electrons is known as electronegative element and forms a negatively charged ion called as anion.
Electronic configuration of sodium:
Sodium atom will loose one electron to gain noble gas configuration and form sodium cation with +1 charge.
Electronic configuration of chlorine:
Chlorine atom will gain one electron to gain noble gas configuration and form chloride ion with -1 charge.