1import { Component } from '@angular/core';
2import { Router } from '@angular/router';
3
4@Component({
5 template: 'The href is: {{href}}'
6 /* Other component settings */
7})
8export class Component {
9 public href: string = "";
10
11 constructor(private router: Router) {}
12
13 ngOnInit() {
14 this.href = this.router.url;
15 console.log(this.router.url);
16 }
17}