Dynamic domain
Hello, how to dynamically change the domain ?
For example:
export function WpApiLoaderFactory(http: Http, config:Config) {
return new WpApiStaticLoader(http, ${config.domain}/wp-json/, /* namespace is optional, default: '/wp/v2' */);
}
Thank you.
Hi Vinnchan,you could do it like this,
export const SITE_URL:string = "config.domain";
in a file then import it in the file where you are calling it,like:
wpApiURL: string = SITE_URL + '/wp-json/wp/v2';
Sorry, I think my last question was ambiguous. I get my domain url from an rest API beforehand. This domain url change according to what user type in. The $config.domain below is actually an url value I get from rest API and I assign it to config.domain. Below example is an interpolation: ${config.domain}/wp-json/
export function WpApiLoaderFactory(http: Http, config:Config) { return new WpApiStaticLoader(http, ${config.domain}/wp-json/, /* namespace is optional, default: '/wp/v2' */); }
The demo only demonstrate assign one domain, I want to know how to assign domain according what domain url value user provide us from a form. Thank you
Interesting question. I am not sure how to do this for now with AoT support. Might be worth looking at libraries such as angularfire2 to see if they support dynamic config.
any update on this? i need that dynamic change too...
Not possible with the current code. PR welcome
any update on this? i need that dynamic change too...