Ammonia acts as a Lewis base due to the presence of lone pair of electrons on the nitrogen atom.Therefore,it can form coordinate bond with electron deficient molecules or a number of transition metal cations to from complex compounds.Ammonia reacts with a solution of Cu2+ to form a deep blue coloured complex.The reaction for the above complex can be written as follows:
Cu2+(aq)+4NH3(aq)⇔[Cu(NH3)4]2+(aq)
Blue Deep Blue
This property of ammonia to form complex compounds is useful in detection of metal ions.