Skip to content

angular-templates templateCache.get delegate fails for certain 3rd libraries #1274

@blongstreth

Description

@blongstreth

Some libraries call $templateCache.get method as part of a check to see if the cache entry exists. If not, the 3rd party library will call $templateCache.set to add the entry. Thus, angular-templates templateCache.get delegate will always fail making it impossible to use 3rd party libraries using the mentioned pattern. As a result, can you please consider not throwing an error exception:

$delegate.get = function(templatePath) {
        var originalResult = originalGet(templatePath);

        if (angular.isUndefined(originalResult)) {
          var fileExtension = ((templatePath.split('.') || []).pop() || '').toLowerCase();

// PLEASE DON"T CHECK OR FIGURE A WAY TO BE SMARTER
          if (templatesFileExtension.indexOf(fileExtension) > -1) {
            throw new Error('[angular-meteor][err][404] ' + templatePath + ' - HTML template does not exists!');
          }
        }

        return originalResult;
      };

Link to code:
https://github.com/Urigo/angular-meteor/blob/master/packages/angular-templates/templates-handler.js

Link to 3rd part library code:
https://github.com/JanStevens/angular-growl-2/blob/master/src/growlDirective.js

Thanks,

Bradley

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions