On this page
MockPlatformLocation
class
Mock implementation of URL state.
class MockPlatformLocation implements PlatformLocation {
  hostname
  protocol
  port
  pathname
  search
  hash
  state
  href: string
  url: string
  getBaseHrefFromDOM(): string
  onPopState(fn: LocationChangeListener): void
  onHashChange(fn: LocationChangeListener): void
  replaceState(state: any, title: string, newUrl: string): void
  pushState(state: any, title: string, newUrl: string): void
  forward(): void
  back(): void
  getState(): unknown
}
   Properties
| Property | Description | 
|---|---|
hostname | 
       Read-Only | 
protocol | 
       Read-Only | 
port | 
       Read-Only | 
pathname | 
       Read-Only | 
search | 
       Read-Only | 
hash | 
       Read-Only | 
state | 
       Read-Only | 
href: string | 
       Read-Only | 
url: string | 
       Read-Only | 
Methods
| 
         
          getBaseHrefFromDOM() 
          | 
      
|---|
        
          | 
      
| 
         
          onPopState() 
          | 
      
|---|
| 
         
          onHashChange() 
          | 
      
|---|
| 
         
          replaceState() 
          | 
      |||||||||
|---|---|---|---|---|---|---|---|---|---|
        
          | 
      
state | 
            any | 
            |
title | 
            string | 
            |
newUrl | 
            string | 
            
Returns
void
| 
         
          pushState() 
          | 
      |||||||||
|---|---|---|---|---|---|---|---|---|---|
        
          | 
      
state | 
            any | 
            |
title | 
            string | 
            |
newUrl | 
            string | 
            
Returns
void
| 
         
          forward() 
          | 
      
|---|
        
          | 
      
| 
         
          back() 
          | 
      
|---|
        
          | 
      
| 
         
          getState() 
          | 
      
|---|
        
          | 
      
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v11.angular.io/api/common/testing/MockPlatformLocation