2

I am trying to create a simple angularjs app with ngroute. but I am getting the following error. please help me.

<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.js"></script> <script src="route.js"></script> </head> <body ng-app="myApp"> <div ng-view></div> </body> </html> 

Javascript:

var app = angular.module('myApp', ['ngroute']); app.config(['$routeProvider', function($routeProvider) { $routeProvider.when("/", { templateUrl: "app,html", controller: "mycont" }); }]); app.controller('mycont', function($scope) { $scope.message = "hello"; }); 

1 Answer 1

3

There is no such module ngroute, it's ngRoute (and similar ngResource). Case matters here. Correct module definition would be:

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

Also watch, app,html in template name.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.