Group one elements, such as sodium and potassium, readily donate an electron and form cations with a +1 charge. These donated electrons are readily accepted by non-metals, such as chlorine and bromine. The non-metals form anions with a negative charge, such as Cl- or Br-. The cations and anions form ionic compounds, such as sodium chloride (NaCl), sodium bromide (NaBr), etc. In the process of formation of ionic bonds, the metal species donate electrons and nonmetal species gain the electrons. Ultimately, the electrons are transferred and by bonding, all the involved atoms attain a noble gas configuration and hence the resulting molecule is neutral, with no charge on it. Similar to group one metals, group two metals also lose electrons and readily form ionic compounds with non metals.
Hope this helps.