I have a MacBook Pro 15 inch 2015 model. Until yesterday it worked fine. But now it shows a black screen. But when I connect to external display through HDMI it works fine.
Is there any solution to solve that problem?
Unfortunatly, it looks like a hardware issue.
Use the external monitor to see what you are doing and go to the system preferences and check the settings. Check the monitor preferences and see if it listed. Try turning the brightness all the way up.
If it is a 2015 model and less than 1 year old Apple should repair it for free. If you have AppleCare extended warranty they will repair it for 3 years for free. Take it to an Apple Store or an Apple approved repair vendor.
It's display cable problem dude check cable connector by opening display case
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.