I'm facing a challenge with importing a variable from one TypeScript file to another.
The specific variable I need to import is called cityListUrl
The TypeScript file where it's defined looks like this:
export class backendUrls{
// root url
rooturl:string= 'http://127.0.0.1:8000';
//get a list of all cities
cityListUrl:string = this.rooturl + '/api/city/';
}
The file I want to import it into has the following structure:
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import {backendUrls} from 'app/backendUrls';
@Injectable()
export class cityGetService{
constructor(private http: Http){}
cityGet(){
this.http.get(backendUrls.cityListUrl)
}
}
When I try to access cityListUrl
in my PyCharm editor, it shows up as red with the message:
TS2339: 'cityListUrl' does not exist on type 'typeof backendUrls'.
Has anyone encountered this issue before? Any suggestions on how to resolve it would be greatly appreciated. Thank you