What is the best way to create config file (Something like web config in .net), for storing urls, and other constants that may vary during the application deploy?
Thinking outside the box, you don't really want to use .constant as it's tied to the application. Use a config that sits outside of the app and you have more control over env configs. I have provided a link below explains the pitfalls of have configs within the angular build itself.
(function hydrateConfiguration() {
"use strict";
var xhr = new XMLHttpRequest();
xhr.open("get", "conf.json", window);
xhr.onload = function () {
var status = xhr.status;
if (status === 200) {
if (xhr.responseText) {
var response = JSON.parse(xhr.responseText);
window.ss_conf = response;
}
} else {
console.error("messages: Could not load confguration -> ERROR ->", status);
}
};
xhr.send() )());
Just a simple example where a external config file controls the state of the app and injects values outside in, instead of inside in.
https://www.jvandemo.com/how-to-configure-your-angularjs-application-using-environment-variables/