错误:[ng:areq] http://errors.angularjs.org/1.3.15

时间:2015-08-27 18:27:15

标签: javascript angularjs

我正在尝试将Angular添加到我的Web应用程序的功能中。这只是我的应用程序的简单绑定,但它根本不起作用。我一直收到这个错误:

Error: [ng:areq]
http://errors.angularjs.org/1.3.15/ng/areq?p0=EmployeeController&p1=not%20a%20function%2C%20got%20undefined
    at Error (native)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:6:417
    at Rb (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:19:510)
    at sb (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:20:78)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:75:396
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:57:100
    at r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:408)
    at B (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:56:471)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:51:335)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:51:352)

我试图添加引用同样的项目也不是来自CDN和同样的问题,它告诉我这个问题。

这是我的HTML页面:JSFiddle

1 个答案:

答案 0 :(得分:1)

您需要先定义控制器,然后才能在标记中使用它:

angular.module('app',[])
.controller('EmployeeController', function($scope) {
    $scope.person = {
        fullname: "Brittany",
        comments: "My comments"
    }
});

plnkr example