Reputation: 2604
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
Upvotes: 1
Views: 31
Reputation:
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']);
Upvotes: 1
Reputation: 3326
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
Upvotes: 1