-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassdata.ts
More file actions
32 lines (29 loc) · 878 Bytes
/
passdata.ts
File metadata and controls
32 lines (29 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//within the sending component
sendingFunction(minimum,maximum,field){
let navigationExtras: NavigationExtras = {
queryParams: {
"search":true,
"minimum": minimum,
"maximum": maximum,
"field":field
}
};
this.router.navigate(["sizepricelimits"], navigationExtras);
}
//on the receiving component
import { ActivatedRoute } from '@angular/router' //we import activatedroute
constructor(
private activatedRoute: ActivatedRoute
) {
//we extract the values within the constructor
this.activatedRoute.queryParams.subscribe((params: { [x: string]: any; })=>{
if(params["search"] === 'true'){
this.minimum = params["minimum"]
this.maximum = params["maximum"]
this.field = params["field"]
}else{
//navigates to a different place if condition fails
this.router.navigate([""]);
}
})
}