unserver-unify
Version:
36 lines (25 loc) • 704 B
JavaScript
'use strict';
angular.module('bamboo')
.controller('CourseVideoDialogCtrl', function($scope, videos, idx) {
var _self = this;
$scope.videos = videos;
$scope.idx = idx;
var initVideo = function() {
$scope.video = $scope.videos[$scope.idx];
$scope.disableNextBtn = ($scope.idx >= ($scope.videos.length-1)) ? true : false;
$scope.disablePrevBtn = ($scope.idx == 0) ? true : false;
};
initVideo();
$scope.prev = function() {
if ($scope.idx > 0) {
$scope.idx-=1;
initVideo();
}
};
$scope.next = function() {
if ($scope.idx < $scope.videos.length - 1) {
$scope.idx+=1;
initVideo();
}
};
});