2

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 :)

BMW83
  • 193
  • 2
  • 3
  • 16

2 Answers2

5

Change

@Injectable

to

@Injectable()
Buczkowski
  • 2,296
  • 12
  • 18
0

It's for the version of the angular 4, 5 or 6 I followed this pages for to update my version and will be run

Angular Injectable decorator - Expected 0 arguments but got 1

Thank you my Friend

BMW83
  • 193
  • 2
  • 3
  • 16