I am attempting to select state from a drop down, after selecting the country and I am to select the state, I do get this error even though everything looks perfect to me
core.js:6210 ERROR TypeError: Cannot read property 'subscribe' of undefined
    at FormComponent.getStateOnCountrySelection
Here is the ts file:
getStateOnCountrySelection(id){
    this.selectedStatesOption = [];
    this.countriesService.getStates(id).subscribe((data:any) =>{
      this.selectedStatesOption.push(data);
    });
  }
Here is the service class class to pick the states
public getStates(id: number): Observable<State[]> {
    let selectedStates;
    this.getCountries().subscribe((data:any) =>{
      let states = data["states"];
      selectedStates = states.filter((data:any) =>{
        return parseInt(data.id) == id
      });
    });
    return selectedStates;
  }
Please what am I doing wrong
 
     
    