Search code examples
angularangular-services

error TS1238: Unable to resolve signature of class decorator when called as an expression. Angular


I have a problem in my project angular but i don't know where is the problem. I want to add a service in my project in that i define this service like that

import {Injectable} from "@angular/core";
import {Http} from "@angular/http";

@Injectable

export class ContactService{

constructor(public http: Http){

}
  getContacts(){
     return this.http.get("http://localhost:8080/findPersons? 
      mc=wa&page=1&size=6").map(resp => resp.json());
}
}

in the console of my IDE i have this mistake ERROR in src/contact.service/contacts.service.ts(4,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.

And i have the same mistake

enter image description here

is there anyone who can help me and thank you :)


Solution

  • Change

    @Injectable
    

    to

    @Injectable()