Slide-box Dynamic Height

Another small problem,
With this code:

.controller('ListCtrl', function($scope, EventService,$location,$localStorage, $ionicActionSheet, $translate,$stateParams){

$scope.gotoSlide = function(index) { $scope.$broadcast('slideBox.setSlide', index); };

var slidenum = $stateParams.slidenum;
if($stateParams.slidenum>=0){
	$scope.$watch(function(){
		$scope.gotoSlide(slidenum);
	});
}
})

I’m getting this error multiplied by the number of pages that I have,

TypeError: Cannot read property 'length' of undefined
    at circle (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:5639:21)
    at slide (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:5666:30)
    at slide (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:6000:7)
    at http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:34181:16
    at Scope.$broadcast (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:19336:28)
    at Scope.$scope.gotoSlide (http://localhost/ionic-angular-cordova-seed-master/www/js/controllers.js:34:46)
    at Object.<anonymous> (http://localhost/ionic-angular-cordova-seed-master/www/js/controllers.js:40:10)
    at Scope.$digest (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:18897:40)
    at Scope.$apply (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:19158:24)
    at done (http://localhost/ionic-angular-cordova-seed-master/www/lib/js/ionic.bundle.js:14916:45)