unserver-unify
Version:
31 lines (29 loc) • 1.07 kB
JavaScript
;
angular.module('bamboo.course').controller("SubjectCtrl", function($scope, $state, $stateParams, ApiService, $rootScope, UserService, AppConfig, VideoService,$location,$anchorScroll,fullWidthService) {
this.id = $stateParams.id;
console.log('SubjectCtrl');
var self = this;
this.item = {};
this.defaultPhotoUrl = "assets/images/course_no-image.jpg";
this.newsPicUrl = ApiService.SHOST + "/subject/";
ApiService.get("/subject/" + self.id).then(function(result) {
// console.log( '-Starting auth session result: ');
if (result.data.success) {
console.log(result.data.data);
self.item = result.data.data || {};
if (self.item.photo) {
self.imageUrl = self.newsPicUrl + self.item.photo;
}
}
});
$rootScope.fullwidthflag = true;
$scope.$on("$destroy", function() {
console.log('-- destroy --');
console.log($state.current.name);
fullWidthService.listen();
});
$scope.scrollTo = function(id) {
$location.hash(id);
$anchorScroll();
};
});