Bug with slidebox

I have a really weird bug. I have a slidebox that calls $rootScope.doMessagesRefresh() when the slide has changed to index 1. I define $rootScope.doMessagesRefresh() = $scope.doRefresh in the javascript file (messages.js) ) that corresponds to index 1. $scope.doRefresh is called whenever the pull down to refresh action is done. The error I’m getting is " undefined is not a function (evaluating ‘$rootScope.doMessagesRefresh()’) " The really weird thing is that the error will go away and work perfectly fine when I comment out some code that makes an http.post in another function in messages.js, even if I make it so that that function with the http.post in it is never called. This makes absolutely no sense to me. Any ideas what’s going on?