Ionic bonding takes place when the metal atom contributes electrons to the non-metal atom. By doing this they both gain stable electronic configurations like the nearest noble gas.