"After the death" (Leviticus 16:1). It was taught [in the name of] Rabbi Eliezer: Nadab and Abihu died only because they ruled a halakhah in the presence of Moses their master. There is a story about Rabbi Eliezer, that his disciple ruled a halakhah before him. He said to Imma Shalom his wife: This man will not live out his year. And so it was: he did not live out his year. His disciples said to him: Our master, are you a prophet? He said to them: "I am neither a prophet nor the son of a prophet" (Amos 7:14). Rather, thus I have received as tradition from my masters: Whoever rules a halakhah in the presence of his master is liable to death.
Why Nadab and Abihu Died for Ruling Before Moses
Midrash Tanchuma Buber, Achrei Mot 6:1
אחרי מות. תני [בשם] ר' אליעזר לא מתו נדב ואביהוא, אלא מפני שהורו הלכה בפני משה רבן, מעשה ברבי אליעזר שהורה תלמידו לפניו הלכה ואמר לאימא שלום אשתו, זה אינו מוציא שנתו, וכן היה לא הוציא שנתו, אמרו לו תלמידיו רבינו נביא אתה, אמר להם לא נביא ולא בן נביא אנכי, אלא כך מקובלני מרבותי, כל המורה הלכה בפני רבו חייב מיתה.