templateCache definition undefined check