Quantcast
Channel: Moodle for mobile
Viewing all articles
Browse latest Browse all 8344

Re: JavaScript code can not be customized :(

$
0
0
by Alvarez SH.  

Hi Daniel, apparentlyit works elsewherecode. But but I want tolist thesectionsconsolelog.



I
trywhat 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!!!



Viewing all articles
Browse latest Browse all 8344

Trending Articles