Some ionic compounds dissolve in water, which arises because of the attraction between positive and negative charges. For example, the salt's positive ions attract the partially negative oxygens in H2O. Likewise, the salt's negative ions attract the partially positive hydrogens in H2O. Note: oxygen is partially negative because it is more electronegative than hydrogen, and vice versa.
However, there is a limit to how much salt can be dissolved in a given volume of water. This amount is given by the solubility product, Ksp. This value depends on the type of salt, temperature, and the common ion effect.
One can calculate the amount of AgCl that will dissolve in 1 liter of water, some algebra is required.