“Winkel -URL -Parameter” Code-Antworten

Angular Get URL -Param

constructor(private activatedRoute: ActivatedRoute) {
  this.activatedRoute.queryParams.subscribe(params => {
        let date = params['startdate'];
        console.log(date); // Print the parameter to the console. 
    });
}
GutoTrosla

Angular GET URL -Params

import { ActivatedRoute } from "@angular/router";

//import ActivatedRoute in constructor()
private $route: ActivatedRoute

// in ngOnInit() call
//myvar is the variable where you want to store your param
this.$route.params.forEach(param =>
	this.myvar = param['whatever your param name is']
);
Victor Grk

Winkel -URL -Parameter

// example url: details?id=2

constructor(private activatedRoute: ActivatedRoute) {
  this.activatedRoute.queryParams.subscribe(params => {
        console.log(params); // Prints {id: "2"}
    });
}
Ham-Solo

Winkel -Set -URL -Parameter

//in your HTML code :
<a href="javascript:;" routerLink="/link/params">
  My link
</a>

// app-routing.module.ts:
//in your Routes array :
{path: '/link/:paramsName', component: MyComponent }
Victor Grk

Ähnliche Antworten wie “Winkel -URL -Parameter”

Fragen ähnlich wie “Winkel -URL -Parameter”

Weitere verwandte Antworten zu “Winkel -URL -Parameter” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen