Add support for $templateCache

Todo: add test cases for this...