Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

angular 1.6 compatibility #380

Merged
merged 1 commit into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: [olivier.combe@gmail.com](mailto:olivier.combe@gmail.com) !
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