You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: Cannot read property 'length' of undefined
at http://readup.co/build/bundle.js:682:40
at http://readup.co/lib/bower_components/angular/angular.js:9137:11
at wrappedCallback (http://readup.co/lib/bower_components/angular/angular.js:6995:59)
at http://readup.co/lib/bower_components/angular/angular.js:7032:26
at Object.Scope.$eval (http://readup.co/lib/bower_components/angular/angular.js:8218:28)
at Object.Scope.$digest (http://readup.co/lib/bower_components/angular/angular.js:8077:25)
at Object.Scope.$apply (http://readup.co/lib/bower_components/angular/angular.js:8304:24)
at done (http://readup.co/lib/bower_components/angular/angular.js:9357:20)
at completeRequest (http://readup.co/lib/bower_components/angular/angular.js:9520:7)
at XMLHttpRequest.xhr.onreadystatechange (http://readup.co/lib/bower_components/angular/angular.js:9490:11) angular.js:5930
It's happening in this method:
factory.getRelatedTags = function(tagName){
var deferred = $q.defer();
var requestURL = '/_/tags/' + tagName + '/items/1';
$http.get(requestURL).success(function(data){
var results = {};
for(var i = 0; i < data.length; i++){
for(var j = 0; j < data[i].tags.length; j++){
if(data[i].tags[j].name !== tagName){
results[data[i].tags[j].name] = data[i].tags[j].name;
}
}
}
deferred.resolve(results);
});
return deferred.promise;
};
At the time of execution, data was:
[{"title":"No items found."}]
Since the object doesn't have a tags property, accessing tags.length fails and the promise is rejected. Check for the presence of tags before attempting to iterate over them.
The text was updated successfully, but these errors were encountered:
At the following URL: http://readup.co/#/pinky
It's happening in this method:
At the time of execution,
data
was:Since the object doesn't have a
tags
property, accessingtags.length
fails and the promise is rejected. Check for the presence of tags before attempting to iterate over them.The text was updated successfully, but these errors were encountered: