Ionic compounds consist of positively and negatively charged ions. An example of this type is sodium chloride, NaCl. In this compound a neutral sodium atom transfer one electron to a neutral chlorine atom. This electron transfer results a sodium ion (Na+) and a chlorine atom (Cl-). The compound NaCl is formed by the attraction between these two ions. In general, positively charged ions (cations) are metal ions and negatively charged ions (anions) are nonmetal ions. Consequently, ionic compounds are generally formed between metals and nonmetals. But the compounds formed with ammonium ions (NH4+) and anions are ionic. For example, ammonium nitrate, NH4NO3, ...
This solution provides a detailed explanation of how to determine if a compound is ionic, polar covalent, or non-polar.