One Direction are an English-Irish pop boy band based in London, consisting of Niall Horan, Liam Payne, Harry Styles and Louis Tomlinson. They signed with Simon Cowell's record label Syco Records after being formed and finishing third in the seventh series of the British televised singing competition The X Factor in 2010. Propelled to international success by the power of social media, One Direction's three albums, Up All Night, Take Me Home and Midnight Memories, (released in 2011, 2012 and 2013 respectively), broke several records, topped the charts of most major markets, and generated hit singles, which include "What Makes You Beautiful", "Live While We're Young" and "Story of My Life". Ed Sheeran has stated in an interview that he was approached by the One Direction boys to write some songs, so he gave them an album of about twenty songs he had written.  Former member Zayn Malik left the band in March 2015.
Ed Sheeran has stated in an interview that while he used to travel around, sleeping on people's couches, he, at one stage, found himself waking up in the same room as Harry Styles of One Direction, and that they became close as a result. Sheeran also said that he is not very close with the other One Direction boys.
Styles supposedly mentioned to Sheeran that One Direction needed one more song for their album, Up All Night, and Sheeran gave them "Moments" as he felt he wouldn't use it anyway.
They recorded "Moments" for their first album which was written by Sheeran and Si Hulbert. They also recorded "Little Things," written by Sheeran and Fiona Bevan and "Over Again" written by Sheeran and Robert Conlon for their second album.
He also wrote a song titled "18" which appeared on One Direction's fourth studio album, Four.