Many ionic solids, such as silver chloride (AgCl) do not dissolve in water. The forces holding the solid AgCl lattice together are too strong to be overcome by the forces favoring the formation of Ag+(aq) and Cl-(aq) ions.
This is not the case with ammonia solution. AgCl is soluble in excess of ammonia solution.
Ag+(aq)+2NH3=Ag(NH3)2+