2

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: '/'
            });
        }]);
12
  • 2
    The content of ng-app does not match with the module name. Commented Jan 29, 2016 at 8:38
  • 1
    why your module name add one more '$' ? Commented Jan 29, 2016 at 8:39
  • edited, now code works in plunker, but not on my computer :( the path to main.html is correct Commented Jan 29, 2016 at 8:48
  • Have you renamed $routingApp to routingApp on your local environment as well? Commented Jan 29, 2016 at 8:55
  • Could you provide some error logs from console on your computer? Commented Jan 29, 2016 at 8:55

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

7 Comments

i've already done that and it works in plunkr but not on my computer :(
I can't figure out what's the problem it looks like some magic that I can't get
Dud, do one thing, just zip your code exactly on your system & upload to somewhere like dropbox , because i also want to see, what is happening when no issue seems to exist in your code. Perhaps, something you are missing on your system.
Are you using internet explorer?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.