Elements of group one and seven form ionic bond because 1 group elements give electrons and 17th group elements receive electrons.
Like common salt( NaCl)
Na electronic configuration ,= 2,8,1
Cl electronic configuration = 2,8,7
Hence, Na will give one electron to chlorine and achieve inert gas configuration. On the other hand chlorine will accept electron given by sodium and achieve inert gas configuration and generate strong electrostatic force of attraction.
Reasoning:-
First group elements have very low ionization enthalpy where as 17th group elements have very less electron gain enthalpy.
They have one more electron than inert gas configuration whereas 17th group elements have only one electron less than inert gas configuration.
1st group elements will easily give electron to achieve inert gas configuration and 17th group elements will receive electron easily to achieve inert gas configuration.