Encountering an error in the console when navigating to URL paths users/personal
or users/:id
:
Error message: angular.min.js:107 RangeError: Maximum call stack size exceeded.
The page seems to be stuck in a loop causing it to hang indefinitely.
Interestingly, removing "users" from the URL resolves the issue. For example, /users
. Below is the relevant code snippet:
Code snippet from app.js file:-
var app = angular.module('angulardemo', ['ngRoute', 'ngCookies']) .constant('API_URL', 'http://127.0.0.1:8001') .config(function ($routeProvider, $locationProvider, $httpProvider) {
$httpProvider.defaults.headers.common = {'Content-Type' : 'application/json'}; $httpProvider.defaults.headers.post = {}; $httpProvider.defaults.headers.put = {}; $httpProvider.defaults.headers.patch = {}; $routeProvider
// route definitions here
.otherwise({
redirectTo: '/',
});
$locationProvider.html5Mode({
enabled: true,
requireBase: false });
$locationProvider.hashPrefix('');
}).run(['$http', '$cookies', function($http, $cookies) {
$http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; }]);
Controller code in personal.controller.js:
app.controller('PersonalController', function ( $scope, AuthService, NavigationService, $http, $location, API_URL){
$scope.navMenu = NavigationService.getNavigation();
});
Directory structure details can be found in the image linked below:
For any suggestions or feedback, feel free to share!
Don't forget to check out the directory structure link for more information.