Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.