1

I'm new to angularjs/js and trying to follow an example in introduction video, but in spite of copying the example, I get errors that does not appear in demonstration video.

The error I get is 'unknown provider routeProvider'.

Can someone explain why I get the error -- and not least how I resolve it?

thanks,

Anders

<!DOCTYPE html>
<html data-ng-app="app">
<head>
<title></title>
<script src="angular.min.js"></script>
<script src="angular-route.min.js"></script>
<script >
    var app = angular.module("app", []);

    app.config(function ($routeProvider) {
    });

</script>
</head>
<body>

</body>
</html>

https://www.youtube.com/watch?v=8ILQOFAgaXE

2
  • specify the dependancy as angular.module("app", ['ngRoute']); Commented Nov 28, 2014 at 9:09
  • Thank you, that was my problem! ;) Commented Nov 28, 2014 at 9:22

2 Answers 2

1

you should add this to the app dependencies:

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

ngRoute is a separate module which contains $routeProvider

The youtube video is referring to a version of angular prior to 1.2 where when ngRoute was present, it was merged with angular itself

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

1 Comment

Indeed, that did the trick ;) You were so fast I can't accept your answer yet -- I'll do it in a few minutes... Thank you!
1

angular route has been moved to a seperate module and you need to download, include angular-route.js in your html file. download the angular-route.js file from here --> https://github.com/angular/bower-angular-route. and change this line var app = angular.module("app", []); to var app = angular.module("app", ['ngRoute']);

Comments

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.