I am receiving Uncaught TypeError: Cannot read property 'length' of undefined
error on the load of a certain page of my ionic app.
Because this error points to a file in the core, I am clueless as to how to debug this. I have performed breakpoints throughout the controller file and I am unable to pin it down.
The error comes up after the full page has loaded.
Hopefully this picture paints a 1000 words.
EDIT
I have now tracked this issue to this piece of code.
$ionicModal.fromTemplateUrl('templates/exercise-modal.html', {
scope: $scope
}).then(function (addExerciseModal) {
$scope.addExerciseModal = addExerciseModal;
});
// Triggered in the exercise modal to close it
$scope.closeAddExerciseModal = function() {
$scope.addExerciseModal.hide();
};
// Open the exercise modal
$scope.OpenAddExerciseModal = function() {
$ionicSlideBoxDelegate.slide(0);
$scope.addExerciseModal.show();
};
However I use this elsewhere in my app and it functions just fine..?
Clearly, slides
is undefined at the time that line is executing. Look backwards through the source code - a few lines above that you should see something that lets you know what slides
is expected to be (if you don't already know).
Then look at how slides
is being created/provided, and follow it back to your own code.