Skip to content

Commit

Permalink
feat: angular 1.6 compatibility
Browse files Browse the repository at this point in the history
Fixes #377
  • Loading branch information
alexan authored and ocombe committed Feb 1, 2017
1 parent 3351e44 commit 17d372f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [[email protected]](mailto:[email protected]) !
7 changes: 4 additions & 3 deletions src/ocLazyLoad.loaders.templatesLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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(() => {
Expand Down

0 comments on commit 17d372f

Please sign in to comment.