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/"
};
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");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.