Q:

$http.get and $templateCache

Could someone explain to me the following code:
$http.get('./template.html', {
    cache: $templateCache
}).then (function(response){
  console.log(response.data);
});

I understand response.data will be equal to the whole content of template.html, however what about the object
{cache: $templateCache}

What does it do?

A:

Here is a line from documentation for $http service:

cache – {boolean|Object} – A boolean value or object created with $cacheFactory to enable or disable caching of the HTTP response. See $http Caching for more information.

So by specifying {cache: $templateCache} you tell Angular to cache HTTP response in internal cache data map, accessible as $templateCache service. It means that if you request ./template.html again with $http.get or by using template as source in ngInclude directive, it will not be redownloaded but will be retrieved from cache. 

