Loving Yourself First? What?

I never really understood when people would say "You have to love yourself first before you love someone in a relationship." I'm going through a really bad heart break ? & one of my friends said this to me. I don't fully understand what she meant ?I mean it's hard... Any clarifications?