The hinge parts just snap together, and they are designed that way so that the closet and cabinet doors can be easily removed. Most likely, the pieces have just come apart.
It's hard to verbally describe how to reassemble the two pieces. However, if you examine a remaining hinge on the closet door, or take a look at one your cabinet hinges, you should be able to figure out how they go together.
These hinges are very strong, and it's unlikely that the parts are damaged beyond repair...
IMPORTANT NOTE: Resist the urge to tighten or adjust the screws on the individual pieces (other than the wood screws that mount the hinge to the door and frame). Some of these screws are used to adjust the swing of the door; and if you fiddle with them, your door may not open/close properly. While the swing can be readjusted later, the process is mainly trial-and-error; and it can be a very frustrating experience. (You can probably guess how I know this.)