angular-cli Firebase hosting Angular 2 router not working

Late response, but since i faced the same problem today when i deployed my app on Firebase, here is the quick fix for it:

In your firebase.json file, update your hosting key by defining rewrite rules:

  "hosting": {
    "public": "dist",
    "rewrites": [ {
      "source": "**",
      "destination": "/index.html"
    } ]
  }

In your app.module.ts file just add following things:

declare

import { LocationStrategy, HashLocationStrategy} from '@angular/common';

and in providers add following

   @NgModule({
        declarations: [...],
        imports:[...],
        providers:[..,{ provide: LocationStrategy, useClass: HashLocationStrategy },..]
        ...,
    })

Hope this will solve your problem.

And if possible keep your Routes in separate file.

Cheers