Search code examples
angularjsangularjs-routing

AngularJS upgrade from 1.4 to 1.5 routes not loading


I upgraded our AngularJS package from 1.4.14 to 1.5.11. In doing so, our routes unexpectedly stopped loading. The base url for our application is baseurl.com/app.

I've reviewed the angularjs migration documents, but cannot find anything that has helped me to fix this issue.

App.config(function($routeProvider) {
    $routeProvider
    // route for the top level
    .when('/', {
        template : '<home></home>',
    })

    // route for a new project
    .when('/new', {
        template : '<new></new>',
    })

    // route for the project overview page
    .when('/view', {
        template : '<overview></overview>',
    })

    // route for the manage page
    .when('/manage', {
        template : '<manage></manage>',
    })

    // route for the base perform page
    .when('/perform', {
        template : '<perform></perform>',
    })

    // default route
    .otherwise('/');
    });


Solution

  • I was able to resolve the issue by adding the code below

    .run(['$route', function() {}]);
    

    This was a known issue in the AngularJS documentation that I missed somehow. https://code.angularjs.org/1.5.11/docs/api/ngRoute#known-issues