Ionic compounds are formed by the transfer of electrons from one element to another. Typically, metals are the electron donors, while nonmetals are the electron acceptors. However, there are some exceptions to this rule, such as the case of ammonium chloride, in which the ammonium ion is a positively charged ion derived from ammonia, a nonmetallic molecule.