code: def angular_templates(context):
      
      template_paths = context['HORIZON_CONFIG']['external_templates']
      all_theme_static_files = context['HORIZON_CONFIG']['theme_static_files']
      this_theme_static_files = all_theme_static_files[context['THEME']]
      template_overrides = this_theme_static_files['template_overrides']
      angular_templates = {}
  
      for relative_path in template_paths:
  
          template_static_path = context['STATIC_URL'] + relative_path
  
          # If the current theme overrides this template, use the theme
          # content instead of the original file content
          if relative_path in template_overrides:
              relative_path = template_overrides[relative_path]
  
          result = []
          for finder in finders.get_finders():
              result.extend(finder.find(relative_path, True))
          path = result[-1]
          try:
              if six.PY3:
                  with open(path, encoding='utf-8') as template_file:
                      angular_templates[template_static_path] = template_file.\
                          read()
              else:
                  with open(path) as template_file:
                      angular_templates[template_static_path] = template_file.\
                          read()
          except (OSError, IOError):
              # Failed to read template, leave the template dictionary blank
              # If the caller is using this dictionary to pre-populate a cache
              # there will simply be no pre-loaded version for this template.
              pass
  
      templates = [(key, value) for key, value in angular_templates.items()]
      templates.sort(key=lambda item: item[0])
  
      return {
          'angular_templates': templates
      }
docs: Generate a dictionary of template contents for all static HTML templates.
  
      If the template has been overridden by a theme, load the
      override contents instead of the original HTML file.
      One use for this is to pre-populate the angular template cache.
  
      Args:
          context: the context of the current Django template
  
      Returns: an object containing
       angular_templates: dictionary of angular template contents
        - key is the template's static path,
        - value is a string of HTML template contents