AngularJS $routeProvider does not have reload method
Asked Answered
U

1

5

The AngularJS documentation indicates that the ngRoute $routeProvider has a reload method.

reload()

Causes $route service to reload the current route even if $location hasn't changed.

As can be seen in this screen shot, the $routeProvider does not have a reload method.

log of actual $route methods

I am initializing my module like this:

var pageApp = angular.module('pageApp', ['ngRoute']);

and I am requesting the $resourceProvider like this:

pageApp.config([
    '$controllerProvider',
    '$compileProvider',
    '$filterProvider',
    '$routeProvider',
    '$provide',
    function($controllerProvider, 
            $compileProvider, 
            $filterProvider, 
            $routeProvider, 
            $provide) { 
        //generate attached screenshot output
        console.log($routeProvider);
        /* ... */ 
     }]);

I am using version 1.2.5

Unknowable answered 18/12, 2013 at 21:14 Comment(0)
S
10

The reload method belongs to the $route service, not the $routeProvider provider.

i.e. you would use that methoid inside a controller, not the config function

app.controller('myCtrl', ['$route', function($route){

    $scope.reloadPage=$route.reload();

}]);
Spoilsman answered 18/12, 2013 at 21:22 Comment(1)
See #15666548 if you're confused about the difference between services and providers. In this case. we have the $route service and the $routeProvider provider.Spoilsman

© 2022 - 2024 — McMap. All rights reserved.