2

Angular 2 Router (ES5) doesn't work on page reload

Angular 2.0 router not working on reloading the browser

My goal is to allow the user to refresh the page by hitting F5 or clicking the refresh button on their browser. I don't mind the hash in the url if that is what it takes.

Per above links several others have attempted the same and my question differs with respect to the version of angular and I am using.

The second link above describes implementing HashLocationStrategy. I cannot find this class in the version of angular I am using (2.0.0-rc.1). If HashLocationStrategy is in fact still the recommended fix, from where do I import and use it? If HashLocationStrategy is deprecated, what is the recommended aproach?

Community
  • 1
  • 1

1 Answers1

0
import {  
  PlatformLocation,  
  Location,  
  LocationStrategy,  
  HashLocationStrategy,  
  PathLocationStrategy,  
  APP_BASE_HREF}  
from '@angular/common';  

See also Location and HashLocationStrategy stopped working in beta.16

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Note to others: You may need to delete ROUTER_PROVIDERS from you components... see http://stackoverflow.com/questions/34318429/hashlocationstrategy-does-not-produce-locations-when-routing/34320196#34320196 –  May 25 '16 at 19:40