by Alvarez SH.
Itrywhat you said:
self.getSection = function(courseid, sectionid, refresh) {
var deferred = $q.defer();
if (sectionid < 0) {
deferred.reject('Invalid section ID');
return deferred.promise;
}
self.getSections(courseid, refresh).then(function(sections) {
for (var i = 0; i < sections.length; i++) {
if (sections[i].id == sectionid) {
console.log(sections[i]); //Sections List!!
deferred.resolve(sections[i])
return;
}
}
deferred.reject('Unkown section');
}, function(error) {
deferred.reject(error);
});
return deferred.promise;
};
Hi Daniel, apparentlyit works elsewherecode. But but I want tolist thesectionsconsolelog.
Itrywhat you said:
self.getSection = function(courseid, sectionid, refresh) {
var deferred = $q.defer();
if (sectionid < 0) {
deferred.reject('Invalid section ID');
return deferred.promise;
}
self.getSections(courseid, refresh).then(function(sections) {
for (var i = 0; i < sections.length; i++) {
if (sections[i].id == sectionid) {
console.log(sections[i]); //Sections List!!
deferred.resolve(sections[i])
return;
}
}
deferred.reject('Unkown section');
}, function(error) {
deferred.reject(error);
});
return deferred.promise;
};
Apparentlynot work, another idea?
thank you very muchfor trying to help!!!
thank you very muchfor trying to help!!!