get current url angular
import { ActivatedRoute, Params } from '@angular/router';
@Component(...)
export class MyComponent implements OnInit {
constructor (private activatedRoute: ActivatedRoute){}
ngOnInit() {
this.activatedRoute.params.subscribe((params: Params) => {
if (params.myParam){
// Do something
}
});
}
}
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);
}
}
Also in JavaScript:
- remove element from javascript array
- javascript clone array of objects
- js convert order to char
- jQuery check element has focus
- js data object length
- javascript get clock time in auto counter up
- TypeError: client.guilds.forEach is not a function
- ionic g service services/auth ionic g service services/authGuard npm i @ionic/storage npm i @auth0/angular-jwt ionic cordova plugin add cordova-sqlite-storage
- nestjs version
- discord js bot leave voice channel
- vowel
- js check if object is empty
- drag n drop file upload react
- javascript genreate number id
- js array length
- react-dates nextjs
- flutter app accessible when phone is locked
- for loop js example
- how to use javascript to get full file path
- stop propagation
- javascript convert minus to plus
- javascript index of biggest number
- how to host a react website
- how to copy one array to another in javascript