-2
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.3.0.min.js"></script>


<html>
    <script>
        var myApp = angular.module('myApp', []);

        myApp.controller('GreetingController', ['$scope', function ($scope) {
            $scope.greeting = 'Hola!';
        }]);

    </script>

    <body ng-app>
        {{1+2}}
        <div ng-controller="GreetingController">
            {{ greeting }}
        </div>
</body>
</html>

Can you please explain to me why it's giving me Error: [ng:areq] http://errors.angularjs.org/1.3.5/ng/areq?p0=GreetingController&p1=not%20a%20function%2C%20got%20undefined

PSL
  • 123,204
  • 21
  • 253
  • 243
David
  • 1,051
  • 5
  • 14
  • 28
  • possible duplicate of [Controller not a function, got undefined, while defining controllers globally](http://stackoverflow.com/questions/25111831/controller-not-a-function-got-undefined-while-defining-controllers-globally) – PSL Jan 05 '15 at 22:09
  • 1
    You are missing `ng-app="myApp"` – PSL Jan 05 '15 at 22:09

1 Answers1

1

You need to add ng-app="myApp".

More info on ngApp directive here

Cristi Berceanu
  • 1,693
  • 1
  • 10
  • 12