(function() { var app = angular.module('todoapp', []); app.controller('TodoCtrl', ['$scope', '$http', function($scope, $http) { //console.log("Hello World from controller"); $http.get('/todolist').success(function(response) { //console.log("I got the data I requested"); $scope.todolist = response; }); $scope.task = { taskname: "E.g Task", Done: false, details: '' } $scope.addTask = function() { //console.log($scope.todo); $http.post('/todolist', $scope.task).success(function(response){ console.log(response); }); $http.get('/todolist').success(function(response) { $scope.todolist = response; }); $scope.todo = ""; }; $scope.markTaskDone = function() { console.log($scope.todo); }; }]); })();