Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic domain #23

Open
vinnchan opened this issue Mar 11, 2017 · 6 comments
Open

Dynamic domain #23

vinnchan opened this issue Mar 11, 2017 · 6 comments

Comments

@vinnchan
Copy link

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.

@finessed
Copy link

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';

@vinnchan
Copy link
Author

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

@shprink
Copy link
Collaborator

shprink commented Mar 13, 2017

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.

@vhb56
Copy link

vhb56 commented Aug 30, 2017

any update on this? i need that dynamic change too...

@shprink
Copy link
Collaborator

shprink commented Aug 30, 2017

Not possible with the current code. PR welcome

@iamandreadompe
Copy link

any update on this? i need that dynamic change too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants