-2

I am using angular.js. I have created app.js file where i entered the code as:

angular.module('polls', ['pollServices'])
.config(['$routeProvider', function ($routeProvider)
     {
    $routeProvider
         .when('/polls', { templateUrl: 'partials/list.html', controller: PollListCtrl })
         .when('/poll/:pollId', { templateUrl: 'partials/item.html', controller: PollItemCtrl })
         .when('/new', { templateUrl: 'partials/new.html', controller: PollNewCtrl })
         .otherwise({ redirectTo: '/polls' });
}]);

but when i run the code, it gives the error as:

angular.module('polls', ['pollServices']
^
ReferenceError: angular is not defined
SA.
  • 732
  • 7
  • 20
  • 38

1 Answers1

0

Your main html file, normally index.html should look like this.

<!DOCTYPE html>
<html ng-app="polls">
<head>
    <title>Website</title>

    <!--<script src="js/libs/jquery.js"></script>-->
    <script src="js/libs/angular.js"></script>

    <script src="js/polls.js"></script>
</head>


<body ng-controller="mainController">
</body>

</html>

PS: Relating to your last comment AngularJS is not a language, but a JavaScript framework.

Johannes
  • 2,732
  • 5
  • 23
  • 32