In ionic bonds, the metal loses electrons to become a positively charged cation, whereas the nonmetal accepts those electrons to become a negatively charged anion. By losing those electrons, these metals can achieve noble gas configuration and satisfy the octet rule. (i found the answer in google hehe)