This repository was archived by the owner on Oct 14, 2024. It is now read-only.
Serving static content based on Angular's BASE_HREF#567
Open
odahcam wants to merge 1 commit intoangular:masterfrom
Open
Serving static content based on Angular's BASE_HREF#567odahcam wants to merge 1 commit intoangular:masterfrom
odahcam wants to merge 1 commit intoangular:masterfrom
Conversation
I was unable to serve my static content when I published my app under a subpath route like `mydomain.com/myapp/*`. Got help from @andrevargas.
Contributor
Author
|
PR description updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: I was unable to serve my static content when I published my app under a subpath route like
mydomain.com/myapp/*.Result: In this PR I created a way to dynamically get the base route of my application (stored in the
BASE_HREFconstant). How: I look intoindex.htmlfile at runtime and do extract the<base href="X">tag's value. Then, instead of using'*.*', I use that value to create my static content route. Now I'm able to publish my application in multiple environments (e.g. development, homolog, production) with just changing the--base-hrefvalue in build configuration time.Got help from @andrevargas.