diff --git a/README.md b/README.md index d491744..f8c8646 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Lazy load modules & components in AngularJS - Load via the service or the directive - Use the embedded async loader or use your own (requireJS, ...) - Load js (angular or not) / css / templates files -- Compatible with AngularJS 1.2.x/1.3.x/1.4.x/1.5,x +- Compatible with AngularJS 1.2.x/1.3.x/1.4.x/1.5.x/1.6.x ## Looking for help I'm looking for contributors to help me maintain the code (I'm gonna switch to Angular 2 soon, and I won't be much more invested in Angular 1 & ocLazyLoad). If you're interested, send me a tweet [@OCombe](https://twitter.com/OCombe) or an email: [olivier.combe@gmail.com](mailto:olivier.combe@gmail.com) ! diff --git a/src/ocLazyLoad.loaders.templatesLoader.js b/src/ocLazyLoad.loaders.templatesLoader.js index fa23f57..45079ce 100644 --- a/src/ocLazyLoad.loaders.templatesLoader.js +++ b/src/ocLazyLoad.loaders.templatesLoader.js @@ -18,7 +18,8 @@ angular.forEach(paths, url => { var deferred = $q.defer(); promises.push(deferred.promise); - $http.get(url, params).success(data => { + $http.get(url, params).then(response => { + let data = response.data; if(angular.isString(data) && data.length > 0) { angular.forEach(angular.element(data), node => { if(node.nodeName === 'SCRIPT' && node.type === 'text/ng-template') { @@ -30,8 +31,8 @@ filesCache.put(url, true); } deferred.resolve(); - }).error(function(err) { - deferred.reject(new Error(`Unable to load template file "${ url }": ${ err }`)); + }).catch(response => { + deferred.reject(new Error(`Unable to load template file "${ url }": ${ response.data }`)); }); }); return $q.all(promises).then(() => {