Interacting selectively and non-covalently with an ankyrin repeat of a protein. Ankyrin repeats are tandemly repeated modules of about 33 amino acids; each repeat folds into a helix-loop-helix structure with a beta-hairpin/loop region projecting out from the helices at a 90-degree angle, and repeats stack to form an L-shaped structure.