Pergunta

This is from the sidewaffle template

interface Ifactory1 {
        greeting: string;
        serviceId: string;
        changeGreeting: () => void;
    }

    class factory1 implements Ifactory1 {
        static serviceId: string = "factory1";
        greeting = "Hello";

        constructor(private $http: ng.IHttpService, private $resource: ng.resource.IResourceService) {
        }

        changeGreeting() {
            this.greeting = "Bye";
        }
    }

    app1.factory(factory1.serviceId, ['$http', '$resource', ($http, $resource) =>
        new factory1($http, $resource)
    ]);

I get the error:

Error   27  Class factory1 declares interface Ifactory1 but does not implement it:
    Type 'factory1' is missing property 'serviceId' from type 'Ifactory1'.  

Nenhuma solução correta

Outras dicas

Static members are not accessible from instances of the class. You need an instance member to fulfill the interface.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top