Metals and nonmetals are involved in ionic bonding, but it specifically refers to two elements that are oppositely charged being bonded to eachother. For example, in NaCl, Na is the cation with a +1 charge and Cl is the anion with a -1 charge. The +1 means it has one more proton than electron, which means Na lost its valence electron to donate to Cl. Na and Cl both now have a full octet, since Cl element has 7 valence electrons, and after accepting the extra electron from Na, it has 8, achieving full octet. Ionic bond occurs with the transfer of electrons (as opposed to covalent bonds, which is when electrons are shared) that results in a more stable state. The Na having that one valence electron makes it eager to want to lose the electron, while the Cl having 7 valence electrons makes it eager to accept one. Therefore, Na transfers its one valence electron to Cl, achieving a more stable state.