In the sodium hydroxide case, hydrogen ions from the acid are reacting with hydroxide ions from the sodium hydroxide - in line with the Arrhenius theory.
However, in the ammonia case, there don't appear to be any hydroxide ions!
You can get around this by saying that the ammonia reacts with the water it is dissolved in to produce ammonium ions and hydroxide ions