For Ramanujan's background see How did Ramanujan learn to do mathematics? According to Hardy himself, he did not teach him any topics, only the idea and perhaps some methods of proof, see his lecture Indian Mathematician Ramanujan. Ramanujan did pick up sporadic bits and pieces of modern mathematics from various sources that Hardy is not too sure about, other than Carr's Synopsis of Elementary Results in Pure and Applied Mathematics. What he learned, with major gaps, of classical and analytic number theory, elliptic functions, asymptotic analysis, hypergeometric series and continued fractions, was self-learning that Hardy does not credit to himself:
"He had been carrying an impossible handicap, a poor and solitary Hindu pitting his brains against the accumulated wisdom of Europe... It was impossible to teach him systematically, but he gradually absorbed new points of view. In particular he learnt what was meant by proof, and his later papers, while in some ways as odd and individual as ever, read like the works of a well-informed mathematician. His methods and his weapons, however, remained essentially the same. One would have thought that such a formalist as Ramanujan would have revelled in Cauchy's Theorem, but he practically never used it, and the most astonishing testimony to his formal genius is that he never seemed to feel the want of it in the least.
[...] For example, in the analytic theory of numbers he had, in a sense, discovered a great deal, but he was a very long way from understand- ing the real difficulties of the subject. And there is some of his work, mostly in the theory of elliptic functions, about which some mystery still remains; it is not possible, after all the work of Watson and Mordell, to draw the line between what he may have picked up somehow and what he must have found for himself... Here I must admit that I am to blame, since there is a good deal which we should like to know now and which I could have discovered quite easily... I never even asked him whether (as I think he must have done) he had seen Cayley's or Greenhill's Elliptic Functions.
[...] Ramanujan's theory of primes was vitiated by his ignorance of the theory of functions of a complex variable. It was (so to say) what the theory might be if the Zeta-function had no complex zeros. His method depended upon a wholesale use of divergent series.... That his proofs should have been invalid was only to be expected. But the mistakes went deeper than that, and many of the actual results were false. He had obtained the dominant terms of the classical formulae, although by invalid methods; but none of them are such close approximations as he supposed.
[...] I do not think that Ramanujan discovered much in the classical theory of numbers, or indeed that he ever knew a great deal. He had no knowledge at all, at any time, of the general theory of arithmetical forms. I doubt whether he knew the law of quadratic reciprocity before he came here. Diophantine equations should have suited him, but he did comparatively little with them, and what he did do was not his best.
[...] In algebra, Ramanujan's main work was concerned with hypergeometric series and continued fractions (I use the word algebra, of course, in its old-fashioned sense). These subjects suited him exactly, and here he was unquestionably one of the great masters... As regards hypergeometric series one may say, roughly, that he rediscovered the formal theory, set out in Bailey's tract, as it was known up to 1920. There is something about it in Carr, and more in Chrystal's Algebra, and no doubt he got his start from that.
[...] In analysis proper Ramanujan's work is inevitably less impressive, since he knew no theory of functions, and you cannot do real analysis without it, and since the formal side of the integral calculus, which was all that he could learn from Carr or any other book, has been worked over so repeatedly and so intensively. Still, Ramanujan rediscovered an astonishing number of the most beautiful analytic identities."
The aforementioned Carr's Synopsis of Elementary Results in Pure and Applied Mathematics had a big impact on Ramanujan early in life:
"It was a book of a very different kind, Carr's Synopsis, which first aroused Ramanujan's full powers... The book is not in any sense a great one, but Ramanujan has made it famous, arid there is no doubt that it influenced him profoundly and that his acquaintance with it marked the real starting point of his career... Carr has sections on the obvious subjects, algebra, trigonometry, calculus and analytical geometry, but some sections are developed disproportionally, and particularly the formal side of the integral calculus. This seems to have been Carr's pet subject, and the treatment of it is very full and in its way definitely good. There is no theory of functions... What is more surprising, in view of Carr's own tastes and Ramanujan's later work, is that there is no elliptic functions. However Ramanujan may have acquired his very peculiar knowledge of this theory, it was not from Carr."