Search code examples
javascripthtmlangularjsangularjs-routing

AngularJS routing doesn't work


I can't implement angularJS routing in my page, when I first made it, it worked, but after browser returns nothing. Code: http://plnkr.co/edit/lIXeC0X6SkzXKcr8hoAp?p=catalogue

app:

    angular.module('$routingApp', ['ngRoute'])
        .config(['$routeProvider', function($routeProvider){
            $routeProvider
            .when('/', {
                templateUrl: 'main.html'
            })
            .otherwise({
                redirectTo: '/'
            });
        }]);

Solution

  • The problem is with your module name, as suggest by @sp00m, see the updated plunkr link below :

    angular.module('routingApp', ['ngRoute'])
        .config(['$routeProvider', function($routeProvider){
            $routeProvider
            .when('/', {
                templateUrl: 'main.html'
            })
            .otherwise({
                redirectTo: '/'
            });
        }]);
    

    PLUNKR