Skip to content

Instantly share code, notes, and snippets.

@mateothegreat
Last active February 14, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mateothegreat/ff68c495976c5e5c62806644fc3a6edd to your computer and use it in GitHub Desktop.
Save mateothegreat/ff68c495976c5e5c62806644fc3a6edd to your computer and use it in GitHub Desktop.
Retrieve the hash value of a route (#myhash)
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-awesome',
templateUrl: './app-awesome.component.html',
styleUrls: [ './app-awesome.component.scss' ]
})
export class AwesomeComponent {
public constructor(private route: ActivatedRoute) {
route.fragment.subscribe((fragment: string) => {
console.log(fragment)
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment