NsWag Swagger-如何从组件获取URL服务

问题描述

如何从组件中获取url服务?我需要执行其他操作(即:保存在本地存储网址上)

在nswag生成的我的service-proxy上,这是生成代码

@Injectable()
export class LocationServiceProxy {
  private http: HttpClient;
  private baseUrl: string;
  protected jsonParseReviver: ((key: string,value: any) => any) | undefined = undefined;

  constructor(@Inject(HttpClient) http: HttpClient,@Optional() @Inject(API_BASE_URL) baseUrl?: string) {
    this.http = http;
    this.baseUrl = baseUrl ? baseUrl : "";
}

/**
 * @param body (optional) 
 * @return Success
 */ 
saveLocations(body: LocationIODto | undefined): Observable<LocationIODto> {
    let url_ = this.baseUrl + "/api/services/app/Location/SaveLocations";
    url_ = url_.replace(/[?&]$/,"");

    const content_ = JSON.stringify(body);

    let options_ : any = {
        body: content_,observe: "response",responseType: "blob",headers: new HttpHeaders({
            "Content-Type": "application/json-patch+json","Accept": "text/plain"
        })
    };

我需要做一些(从我的组件中)this.locationService.GetUrl()或类似操作,是否有配置来自动生成方法?并检索 url 参数?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)