2

I have a Angular 2 app that has a login component that I want to have a subdomain of login.mydomain.com, and then an admin dashboard component which I want to be portal.mydomain.com. How do I make this happen using the Angular 2 Router? or is there a different approach I should take? Oh and I am using the Angular-cli and I know about the ng build --base-href command.

Amen Ra
  • 2,843
  • 8
  • 47
  • 85
  • It can't be done with Angular. You would need to have actual link leading to subdomain (with a page reloading). Please, have a look on this answer https://stackoverflow.com/questions/14807921/html5-history-api-pushstate-from-a-domain-to-a-subdomain – Denys Reshetniak Jun 06 '17 at 09:35

1 Answers1

1

You don't need any configuration here. Those two sub domains are different apps. Use routes instead, like example.com/#/login & /#/portial.

But if you are going to have two different app. Just Upload your files in folder of your sub domains.

Angular has nothing to do with your sub domains.

But if you are going to do something like this for different apps example.com/login & example/partial (without sub domains).

Then you need to set base href in your angular.json configuration

molikh
  • 1,274
  • 13
  • 24