The singer, who has supported the Rams since he was four, was being filmed at Pride Park for a new film being made about the boy-band.
The film is being directed by Morgan Spurlock, who is the documentary maker behind Supersize Me, where he ate nothing but fast food for 30 days to see what effect it had on his health.
Niall had a kick-about on the pitch with some of his friends before the game kicked off, but no other members of the group were there.
More top news
An MP has provoked anger over comments she made on her Facebook page about junior doctors 'holding the NHS to ransom'.
Student Karishma Kapoor is in line for a £10,000 win if Leicester City win the Premier League after placing a £2 bet.
A teenager has died after a car ploughed into a group of pedestrians in a hit-and-run in Leicester.