To sum it up, the adhesive property of an epoxy is the result of inter-molecular forces and the formation of mechanical bonding.
Adhesives cure when the small resin molecules (mers) join together to form extremely large molecules known as polymers.
Some adhesives are used only with specific substrates because of the cure time needed to allow for good bonding (both with the substrate and for polymer formation.)
I had trouble finding information saying that all epoxies use ionic bonding, and it seems to me that most epoxies will actually just utilize intermolecular forces such as
- Ion-induced dipole forces
- Ion-dipole forces
- Van der Waals forces
- Hydrogen bonding
An important first step in applying an epoxy is the wetting of the surface and then the polymerization of the epoxy. The ability to wet is related to viscosity and the inter-molecular forces. If there is a low viscosity and strong attraction between the substrate and the adhesive then we can witness the formation of mechanical bonding. Below is an explanation:
In order for an adhesive to bond two surfaces, there must be several types of interaction between the adhesive and both substrates. The first type of interaction is that the adhesive must wet the substrate, meaning that the adhesive must spread itself out into a film that covers the substrate surface. In order for this to happen, the adhesive must have a low enough viscosity so that it will flow. Because viscosity is temperature dependent, the application of a cold adhesive to a substrate, or the application of an adhesive to a cold substrate, may result in poor wetting. Another factor that affects wetting is the relative strengths of cohesive forces (between like molecules, such as two adhesive molecules) and those of adhesive forces (between unlike molecules, such as an adhesive molecule and a substrate molecule). If the cohesive forces among adhesive molecules are weaker than the adhesive forces between the adhesive molecules and the substrate surface, then the adhesive molecules will spread out over the substrate and wet its surface. An adhesive that has a relatively low viscosity and is able to wet the substrate surface will flow into any tiny cracks or pores on the substrate surface, thus promoting what is known as mechanical bonding. Mechanical bonding increases the strength of an adhesive bond and, as a result, a forced separation of the two substrate surfaces is more apt to tear the substrate surfaces.
Mechanical bonding is one of several ways that an adhesive bonds substrates. All surfaces, except those that are highly polished, have pores. If the adhesive flows into these pores and then polymerizes, a mechanical bond is formed. It is similar to placing a wick into liquid candle wax. Once the wax solidifies the wick can not be easily removed. A mechanical bond has formed.
Quotation and information from this answer were sourced here.