I am currently getting this error:
TS2339:Property 'getCityList()' does not exist on type type of 'ServerComService'
I am injecting a service into another service. The dynamicFormDataService populates my select inputs in my html
the serverComService deals with all calls to my servers
all proper imports in the app module have been made, both services are in the providers array in the app module. Lets just be sure to state that.
The code for the dynamicFormDataService:
import {Injectable} from '@angular/core';
import 'rxjs/Rx';
import {ServerComService} from "./serverComService";
@Injectable()
export class cityGetService{
constructor(private serverComService: ServerComService){}
cityList= [];
cityGet(){
if(this.cityList.length > 0 ){
return this.cityList;
}
this.cityList = ServerComService.getCityList();
return this.cityList;
}
}
The code for the serverComService
import {Injectable} from '@angular/core';
import {Http} from "@angular/http";
import {cityListUrl} from 'app/backendUrls';
@Injectable()
export class ServerComService{
constructor(private http: Http){}
getCityList(){
value;
this.http.get(cityListUrl)
.subscribe(
(response)=> value = response,
(error)=> console.log(error)
);
return value;
}
}
anything you see that I am doing wrong. Thank you my homies I baked cookies I'll mail you 2 =)