UNPKG

unserver-unify

Version:

29 lines (28 loc) 811 B
'use strict'; angular.module('bamboo.course').controller('MyTestsCtrl', function($scope, ApiService, $stateParams) { this.id = $scope.id = $stateParams.id; // this.mvsubject = {}; var _self = this; this.completed=0; $scope.appUrl = ApiService.APPURL; function getInfo() { var examinfo = { action: 'getmytests', } console.log(examinfo); ApiService.post('/lcourses', examinfo).then(function(result) { console.log(result.data.data); $scope.testitems=result.data.data; var completed=0; angular.forEach($scope.testitems,function(item){ console.log(item); if(item.resultid){ completed++; } }) _self.completed=completed; console.log(_self.completed); }); }; getInfo(); });