/// <reference path='../../typings/angularjs/angular.d.ts' />

module Demo {
    export class ItemsService {
        http: ng.IHttpService;

        constructor(public $http: ng.IHttpService) {
            this.http = $http;

        }

        getItemsList = (successCallback : (data: Array<Item>) => void) => {
            var errorCallback = (error: any) => {
                console.log(error);
            }

            this.http({
                method: 'GET',
                url: '/items'
            }).success(successCallback).error(errorCallback);
        }
    }

    angular.module('Demo').service('itemsService', [
        '$http',
        ($http) => new ItemsService($http)]);
} 