UNPKG

unserver-unify

Version:

30 lines (29 loc) 943 B
'use strict'; angular.module('bamboo.mystudy').controller('MyClassesCtrl', function($scope, MystudyService) { var _self = this; console.log("-- class --"); $scope.setting = { hasPhoto: false, listName: "classes", emptyTitle: 'No Class!', pageSize: 6, currentPage: 1, }; $scope.avataUrl = "assets/images/default-person-icon.png"; $scope.classTeacherMap = {}; this.init = function() { MystudyService.getClassInfoForCurrentUser(function(data) { _self.myclasses = data; console.log(data) angular.forEach(data, function(clz, idx) { var classId = clz._id; classId && MystudyService.getTeachersByClassId(classId).then(function(teacherList) { console.log(teacherList); $scope.classTeacherMap[classId] = teacherList.shift(); }); }); }); } //getTeachersByClassId() _self.init(); })