简单的平均应用程序无法正常工

时间:2016-11-21 14:46:43

标签: javascript angularjs

我正在尝试运行一个简单的平均应用程序,它无法正常工作。我收到以下错误:http://errors.angularjs.org/1.4.9/ng/areq?p0=meetupsController&p1=not%20a%20function%2C%20got%20undefined(Argument' meetupsController'不是函数,未定义)

这是我的代码

server.js

SELECT sum(result.duplicate) AS Summary FROM (
SELECT CandidateId, COUNT(*) as duplicate
FROM Table_CandidateInfo_Preview
GROUP BY CandidateId
HAVING COUNT(*) > 1) as result

我的角度控制器:

var express = require('express'),
    app     = express();

app.get('/', function(req, res){
    res.sendfile(__dirname + '/client/views/index.html');

});


app.use('/js', express.static(__dirname + '/client/js'));
app.listen(3000, function() {
console.log('I mlistening on 3000');
})

mu html文件:

var app = angular.module('meetupApp', ['ngResource']);
app.controller('meetupsController', ['$scope', '$resource', function($scope, $resource){

    $scope.meetups = [
     {name : "First"},
     {name : "second"},
    ]

$scope.createMeetup = function(){
    $scope.meetups.push({name: $scope.meetupName});
    $scope.meetupName='';
}

}])

请帮助

1 个答案:

答案 0 :(得分:3)

在您的<html ng-app>中,您应该添加角度应用,例如:

<html ng-app="meetupApp">
...
</html>