خرید بک لینک

Vote count: 0

I'm trying to make use of my API with AngularJS, I made a service which I'm now trying to load into a contoller, but I'm having some errors..

Unknown provider: ApiServiceProvider <- ApiService <- ManageIntranetController

Also, fyi, I'm using TypeScript.

My service looks like this:

module Services {
    export class ApiService {

        getIntranetItems: (action: string) => any;

        constructor($scope, $http: ng.IHttpService) {

            this.getIntranetItems = (action: string) => {
                retu $http({
                    method: "GET",
                    url: "https://localhost:44326/api/intranet/" + action,
                    headers: { 'Content-Type': 'application/json' }
                }).success(function (data) {
                    $scope.intranetItems = data;
                }).error(function (msg) {
                    alert("ERROR: " + msg);
                })
            };

        }
    }
}

Any my controller looks like this:

/// <reference path="../services/apiservice.ts" />


module Controllers {
    export interface IManageIntranetController extends ng.IScope {

    }    

    export class ManageIntranetController {
        constructor($scope: IManageIntranetController, ApiService: Services.ApiService) {
            console.log(ApiService.getIntranetItems("get"));
        }
    }
}

Thanks in advance!

asked 48 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 2 ارديبهشت 1395 ساعت: 18:35

صفحه بندی