We are hosting a new application with angular 6 and we have many servers with diff URLs, i want to change them automatically(like .property file in java). after searching in google i got some answers like changing paths in environment.ts file, so it will affect to all components. but its not exactly my requirements, means if i change URL in environment.ts file, we should save the file and we need to compile it once again. So exactly this is the problem i am facing, i don't want to save / compile the file.
Please help me in this situation.
service.ts file.
emplLoginCheckUrl = this.baseUrl+"/checkValidUser";
i tried to change base url from environment.ts file, its working correctly but after saving the file, i dont want want save file it should change automatically.
.service.ts file.
emplLoginCheckUrl = this.baseUrl+"/checkValidUser";
validateUserDetails(employeeDetails): Observable<any> {
console.log(this.baseUrl);
return this._httpClinet.post(this.emplLoginCheckUrl, employeeDetails);
}
environment.ts file.
export const environment = {
production: false,
baseUrl: "http://rest/somerestservice"
};
Expected:
URLs should change automatically without saving/running/compiling/building again and again, because only one time I can do saving/running/compiling/building while hosting. after hosting if I want to change URLs I can't go there, change the path and cant compile it once again.