I have been trying to do this for a while now to no avail. could you guys point me in the right direction?
I made a controller for angularjs to animate a slideshow. here's the controller:
angular.module('common').controller('VideoModalController', ['$scope', 'SessionService', 'DateTimeService',
function ($scope, SessionService, DateTimeService) {
$scope.view = {};
// Close the modal
$scope.hideVideos = function () {
$scope.$close();
};
//next slide
$scope.nextSlide = function () {
target = $('ul.triggers li.active').index();
target === lastElem ? target = 0 : target = target+1;
sliderResponse(target);
};
//prev slide
$scope.prevSlide = function () {
target = $('ul.triggers li.active').index();
lastElem = triggers.length-1;
target === 0 ? target = lastElem : target = target-1;
sliderResponse(target);
};
}
]);
What I'm trying to do is make my jquery work inside of it. I've tried everything I could think of got no results. here's my jquery:
<script type="text/javascript">
var triggers = $('ul.triggers li');
var videos = $('ul.videos li');
var lastElem = triggers.length - 1;
var target;
triggers.first().addClass('active');
videos.hide().first().show();
function sliderResponse(target) {
videos.addClass('hiddenvid').fadeOut(900).eq(target).fadeIn(900).removeClass('hiddenvid');
triggers.removeClass('active').eq(target).addClass('active');
}
triggers.click(function() {
if (!$(this).hasClass('active')) {
target = $(this).index();
sliderResponse(target);
}
});
</script>
I tried placing the jquery inside the controller file and changing the variables to $scope.Somevariable but it still didn't work. the only thing I managed to do was get the ng-click working right.
any help would be greatly appreciated. thanks