1

Following is the demo page using google angular js cdn:

    <html ng-app>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
    </head>
    <body ng-controller="TextController">
        <p>{{mytext}}</p>
    </body>
    <script>
        function TextController($scope) {
            $scope.mytext = "hello world";
        }
    </script>
    </html>

and I used the latest google angular js cdn.

It gives a series of errors as follows:

angular.js:13708 Error: [ng:areq] http://errors.angularjs.org/1.5.7/ng/areq?p0=TextController&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:6:412
at sb (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:22:508)
at Qa (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:23:78)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:89:273
at ag (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:72:353)
at m (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:64:218)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:58:481)
at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:58:498)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js:58:119(anonymous function) @ angular.js:13708

However when I changed the version of angular to 1.0.1. The page is shown properly.

Does the new version made any change?

Xiaojun Chen
  • 1,222
  • 2
  • 12
  • 21

2 Answers2

2

I don't know from which version but the controller must be registered to de app.

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

app.controller('TextController', TextController);

Also you need an app priveder.

<html ng-app="app">
Juan Je García
  • 611
  • 1
  • 8
  • 14
1

You need to define the module and the controller... there are no problem with cdn:

<html ng-app="app">

and

<script>
    angular.module('app', []).controller('TextController', TextController);
    ...

look this jsbin: jsbin

Joao Polo
  • 2,153
  • 1
  • 17
  • 26