title: Get the name of a TypeScript class at runtime and use it in URL
body: <p>I have seen several questions regarding getting the name of a typescript class upon runtime.</p>
  <p>Currently I have something implemented along the lines of this.</p>
  <pre><code>export class ApiBase
  {
  
    constructor()
    {
      const instance = new ApiBase();
  
      console.log(instance.constructor.name); 
      console.log(ApiBase.name);              
    }
  
  }
  </code></pre>
  <p>However, I want to create a function and or class that inherits this ability and uses it to insert that class name into the URL. For example I have this class:</p>
  <pre><code>export class WeatherForecast {
    public forecasts: WeatherForecast[];
    public ID: any;
    forecast: any = [];
  
    constructor(private http: HttpClient, private formBuilder: FormBuilder, private router: ActivatedRoute) {
      http.get&lt;any[]&gt;('API/' + **CLASSNAMEHERE**  ).subscribe(result =&gt; {
        this.forecast = result;
      }, error =&gt; console.error(error));
    }
  }
  </code></pre>
  <p>By doing this I should be able to have this service abstracted enough to be able to apply this to any controller or API rather than just my own. Am I on the right track? How might I complete this?</p>