(function (angular) {
	'use strict';

	var app = angular.module('application.main');

	app.controller({
		ItemsController: function ($scope, items, $http) {
			$scope.model.items = items;

			$scope.vote = function(id){
				$http.post('/api/vote/'+id)
					.success(function(data){ })
					.error(function(data){ });
			};
		}
	});
}(angular));
Application.main.controller('ItemsController', ['$scope', 'items', '$http', ItemsController]);
function ItemsController( $scope, items, $http ) {
	console.log(items);
  $scope.model.items = items;

	$scope.vote = function(id){
		console.log('voting for item '+id);
		$http.post('/api/vote/'+id)
			.success(function(data){
				console.log('success!', data);
			})
			.error(function(data){
				console.log('error', data);
			});
	}
}

Revert "rearrange controller to make it more readable"
Revert "rearrange controller to make it more readable"

This reverts commit 6f8d4777b150b1b6b157c1cd924de6e9f31f9d14.
