It is very common (see e.g. page 18 of Ballentine's Quantum Mechanics: A Modern Development) for the following development to take place. We couch the discussion in Dirac's bra-ket notation noting that (as I am not really capable of) it is possible to make this precise in the rigged Hilbert space formalism (for operators with continuous spectra etc.).
It is a fact that self-adjoint operator $A$ admits a complete eigenbasis, so that it is a subsequent theorem that we can write $A$ as $$A = \sum a_i |a_i \rangle \langle a_i |.$$ It is then very common to say that this motivates the definition of a function of such an operator, $f(A)$, by $$f(A) = \sum f(a_i)|a_i \rangle \langle a_i |.$$
My question surrounds the definition of the function of an oeprator. My suspicion is that there is a different definition of $f(A)$ from operator theory, and that the definition I have quoted above is equivalent to said definition via some theorem. Is that indeed the case?