On click next, URL is getting change but the page, as per url doesn't load. when I click next, url changes and if I refresh the page using same url then it loads the correct page. Below is my ts and html code.
on ts
ngOnInit() {
const queryParams = this.route.snapshot.queryParams; // store query param value
this.index = queryParams.index;
this.step = queryParams.step;
this.flowType = queryParams.flowType;
this.stepper.selectedIndex = Number(this.step);
console.log(this.index, "this.index", this.step, "this.step", this.flowType, " this.flowType");
}
on HTML
<div *ngIf="flowType === 'Prescription Drug Plan'">
<app-form-navigation (customHandle)="setApplicationQualification()" isQueryParamPreserve='true'
nextPath="enrollments/steps/find-a-drug" [queryParams]='{index:2, step:0}' >
</app-form-navigation>
</div>
Angular won't reload the same component if you don't navigate away from it. you should use something similar:
constructor(protected route: ActivatedRoute){
}
ngOnInit(){
this.route.queryParams.subscribe(params => this._init(params));
}
_init(queryParams){
this.index = queryParams.index;
this.step = queryParams.step;
this.flowType = queryParams.flowType;
this.stepper.selectedIndex = Number(this.step);
console.log(this.index, "this.index", this.step, "this.step", this.flowType, " this.flowType");
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments