Polyatomic ions are covalent compounds that have an overall charge.
In the ammonium ion, #NH_4#, nitrogen is covalently bonded (shares electrons)to four separate hydrogen atoms.
According to valence electrons rule, the compound should have 9 valence electrons, 4 from hydrogen and 5 from nitrogen. But the compound contains eight electrons; it is missing one electron to give a charge of plus one.
In the nitrate ion, #NO_3#, there are two single covalent bonds between the central nitrogen atom and two oxygen atoms and a double covalent bond with a third oxygen atom. The valence electron number for this compound is 23, ( 5 from nitrogen , 6 from each oxygen). Because the compound contains an extra electron, the overall charge is minus one.
In conclusion, the various elements are held together with covalent bonds, but the compound possesses an overall charge, so that the entire compound behaves as ion and can be used in ionic bonding.