Answers for "angular route current url"

2

get current url angular

import { Component } from '@angular/core';
import { Router } from '@angular/router';

@Component({
    template: 'The href is: {{href}}'
    /*
    Other component settings
    */
})
export class Component {
    public href: string = "";

    constructor(private router: Router) {}

    ngOnInit() {
        this.href = this.router.url;
        console.log(this.router.url);
    }
}
Posted by: Guest on July-27-2020
3

angular get current route

this.router.url === '/login'
Posted by: Guest on December-27-2020

Code answers related to "angular route current url"

Code answers related to "Javascript"

Browse Popular Code Answers by Language