When AgCl is added to aqueous ammonia, it reacts to form a soluble complex ion, [Ag(NH3)2]Cl. This complex ion can then be separated from the insoluble BaCl2 by filtration. The filtrate can then be evaporated to dryness to obtain pure AgCl.
The overall reaction for the dissolution of AgCl in aqueous ammonia is:
$$\text{AgCl (s)} + 2\text{NH}_3 (\text{aq}) \rightarrow [\text{Ag}(\text{NH}_3)_2]^+ (\text{aq}) + \text{Cl}^- (\text{aq})$$
This reaction is reversible, and the equilibrium constant for the reaction is:
$$K = \frac{[\text{Ag}(\text{NH}_3)_2]^+[\text{Cl}^-]}{[\text{AgCl}]}$$
The value of K is very large, which means that the reaction proceeds almost completely to the right, resulting in the formation of the soluble complex ion [Ag(NH3)2]Cl.