GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • LocationStrategy
  • Location
  • hash fragment
  • HashLocationStrategy

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — HashLocationStrategy • Angular

API

    
      class HashLocationStrategy extends LocationStrategy implements OnDestroy {}
    
    
@param_platformLocationPlatformLocation
@param_baseHrefstring | undefined
@returnsHashLocationStrategy
@paramfnLocationChangeListener
@returnsvoid
@returnsstring
@paramincludeHashboolean
@returnsstring
@paraminternalstring
@returnsstring
@paramstateany
@paramtitlestring
@parampathstring
@paramqueryParamsstring
@returnsvoid
@paramstateany
@paramtitlestring
@parampathstring
@paramqueryParamsstring
@returnsvoid
@returnsvoid
@returnsvoid
@returnsunknown
@paramrelativePositionnumber
@returnsvoid

Description

A LocationStrategy used to configure the Location service to represent its state in the hash fragment of the browser's URL.

For instance, if you call location.go('/foo'), the browser's URL will become example.com#/foo.

Usage Notes

Example

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

@Component({
  selector: 'hash-location',
  providers: [Location, {provide: LocationStrategy, useClass: HashLocationStrategy}],
  template: `
    <h1>HashLocationStrategy</h1>
    Current URL is: <code>{{ location.path() }}</code
    ><br />
    Normalize: <code>/foo/bar/</code> is: <code>{{ location.normalize('foo/bar') }}</code
    ><br />
  `,
  standalone: false,
})
export class HashLocationComponent {
  location: Location;
  constructor(location: Location) {
    this.location = location;
  }
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.