angular.module('myApp', []); myAppModule.controller('FirstController', function($scope, $http) { $http.get('/api/items') .success(function(data, status, headers, config){ }) .error(function(data, status, headers, config){ }); $scope.add = function(data) { $http.post('/someUrl', data) .success(function(data, status, headers, config){ }) .error(function(data, status, headers, config){ }); } }); </script>