UNPKG

unserver-unify

Version:

41 lines (37 loc) 1.39 kB
'use strict'; angular.module('bamboo.topic').controller('CourseCourseTopicsCtrl', function($scope, ApiService, $stateParams, smoothScroll) { var _self = this; this.industries = []; this.id = $stateParams.id; $scope.itemsByPage = 15; this.getTopics = function(tableState) { console.log(tableState); var limit = tableState.pagination.number; var start = tableState.pagination.start; var search = tableState.search.predicateObject; var info = { id:_self.id, action:"getLCoursesTopic", start: start, limit: limit, sort: tableState.sort, search: search, }; ApiService.post("/mvtopics", info).then(function(result) { if (result.data.success) { $scope.subjectname=result.data.data.name; $scope.displayedTopics = result.data.data.topics; console.log(_self.id); tableState.pagination.numberOfPages = parseInt(result.data.data.counter / limit); //console.log(tableState.pagination.numberOfPages); $scope.totalcounter = result.data.data.counter; } }); ApiService.get('/course/' + _self.id).then(function (result) { if (result.data.success&&result.data.data.contents) { //console.log(result.data.data); _self.discussionId = result.data.data.contents[0].id; } }) }; });