2

I am trying to change environment variable when I am inserting custom URL in text box and that will be change in Environment Variable on the basis of that am showing response on website.

Here is my TypeScript code:

   generateQRCode() {
      this.value = this.qrcodename;
      localStorage.clear()
      localStorage.setItem("key", JSON.stringify(this.qrcodename));

  }

HTML

  <div class="form-group">
      <input
        type="text"
        class="form-control"
        id="qr"
        aria-describedby="qr"
        placeholder="Enter code"
        required
        [(ngModel)]="qrcodename"
      />
    </div>

and i want to change at this baseUrl with value of qrcodename

export const environment = {
  production: false
   baseUrl: "http://127.0.0.1:5000/"

};

1 Answer 1

1

I just do with local storage and access it on where i want to use this Url input here is my simple code

  getDashboardData(): Observable<any> {

    let url = JSON.parse(localStorage.getItem('key'));
    return this.http.get(url + "/dashboard");

}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.