Created
September 1, 2017 13:53
-
-
Save adamtester/163602e8f48c7978738af67449c3f66b to your computer and use it in GitHub Desktop.
Angular 4 Hash URL on local, HTML5Mode on production
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
import { NgModule } from '@angular/core'; | |
... | |
import { environment } from '../environments/environment'; | |
@NgModule({ | |
... | |
providers: [{ | |
provide: LocationStrategy, | |
useClass: environment.production ? PathLocationStrategy : HashLocationStrategy, | |
}], | |
... | |
}) | |
export class AppModule { } |
I think It should be like useClass: environment.production? HashLocationStrategy: PathLocationStrategy
. Because PathLocationStrategy
does not work on production, and HashLocationStrategy
does not work with navigate on local
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have any solution to remove # from url ?