UNPKG

unserver-unify

Version:

54 lines (52 loc) 1.79 kB
'use strict'; angular.module('bamboo.additional').controller('PortfolioCtrl', function(ApiService, Lightbox, $rootScope, $scope, fullWidthService) { var self = this; this.defaultPhoto = 'assets/images/news_no-image1.jpg'; this.photoPath = ApiService.SHOST + '/advinfo/'; this.key = ''; self.industry = []; self.sorting = ["K12","Higher Education","Enterprise","Industry Learning"]; function getInfo() { var info = { type: 'school', action:"getusecases" }; console.log(info); self.portfolio = []; ApiService.post("/advinfo", info).then(function(result) { console.log(result); if (result.data.success) { self.portfolioList = result.data.data.items; self.totalCount = result.data.data.counter; angular.forEach(self.portfolioList,function(o){ if(o.photo){ self.portfolio.push({ url: self.photoPath + o.photo, thumbUrl: self.photoPath + o.photo, caption: o.name }); if(o.industry&&o.industry=='others'){ self.industry.push(o.others); self.sorting.push(o.others); } else if(o.industry) { self.industry.push(o.industry); } } }); self.industry.sort(function(a, b) { return self.sorting.indexOf(a) - self.sorting.indexOf(b); }); console.log(self.industry); } }); } getInfo(); this.openLightboxModal = function(index) { Lightbox.openModal(self.portfolio, index); }; $rootScope.fullwidthflag = true; $scope.$on("$destroy", function() { console.log('-- destroy --'); fullWidthService.listen(); }); });