1

I'm hesitant to ask what seems to be such a simple question but I have searched all afternoon for an answer and nothing seems to cut it. In fact, I'm yet to find a similar question - which is usually a sign that the real problem is somewhere between the chair and the keyboard. At this point though I'm fully ready for a serving of humble pie.

I am busy experimenting with the Angular 2 CLI - which I am deploying to Github pages... everything is done by the book and works really nicely when I use the standard url, i.e. 'username.github.io/projectname'. However, once I register and access the site through a custom domain I am unable to deeplink into any given page except of course the index.

I am quite stumped. I have set my base href to '/' and like I mentioned all works well until its accessed through a custom domain. That lead me to believe that it may be in the DNS set up but it really is a relatively simple A record pointing to the Github servers as per their docs.

Any light shed on this would be really helpful! I'll include snippets I believe to be relevant but let me know if I can provide any further info. I am using RC4 and the CLI is beta 10. The DNS registrar is Godaddy.

Thanks in advance.

*environment.js

module.exports = function(environment) {
  return {
    environment: environment,
    baseURL: '/',
    locationType: 'auto'
  };
};

*index.html

<head>
  <meta charset="utf-8">
  <title>Angular2Test</title>
  <base href="/">
</head>

*bootstrap

bootstrap(AppComponent, [
    disableDeprecatedForms(),
    provideForms(),
    CommonService,
    HTTP_PROVIDERS,
    APP_ROUTER_PROVIDERS
])
.catch((err: any) => console.error(err));

1 Answers1

0

I was able to deploy my app to Github pages with a custom domain using the following Angular CLI command. I didn't manually update base href in my index.html file. I just did it through the command line.

ng github-pages:deploy --bh / --message "Commit message"

clo5ure
  • 90
  • 14