Angular2 uses navigate for route hopping, and the ngoninit cycle function is not triggered for the new route.

Jump method: _ this represents the component instance

      _this.router.navigate(["/analysis/examdetail"],
        {
          queryParams: _this.params
        });

in the new route:

  constructor(private route: ActivatedRoute, private mrequest: MrequestService, public changeDetectorRef: ChangeDetectorRef) {
    this.route.queryParams.subscribe(params => {
      console.log(params);
      this.e_id = params.e_id;
      this.p_id = params.p_id;
      this.endtype = params.endtype;
    });
    this.isIOS = mrequest.isIOSPlatform();
    console.log(this.endtype);
    this.getExamDetail();

  }

  ngOnInit() {
  console.log(2222);
  }
The jump on the

page is done by clicking on the echarts bar chart

    this.echartsIntance.on("click", function(params) {
      // console.log(params);
      const dataIndex = params.dataIndex;
      // console.log(_this.examId);
      _this.params["e_id"] = _this.examId[dataIndex];
      _this.params["p_id"] = _this.paperId[dataIndex];
      _this.params.cid = _this.classIdList[dataIndex];
      // console.log(_this.params);
      _this.router.navigate(["/analysis/examdetail"],
        {
          queryParams: _this.params
        });
    });

is it suspected that the jump angular2 in echarts cannot be detected? Is there any solution? The code in the
constructor can be executed, but the data in it cannot be rendered to the page, and the console cannot print the information in the ngoninit.

Mar.10,2021

you can try to capture route jump events in the component where router-outlet is located, and then update the contents via ChangeDetectorRef
I'm not sure if it's appropriate, but it works on my side


so ok

constructor(private  router: Router) {
    this.router.routeReuseStrategy.shouldReuseRoute = function() {
        return false;
    };
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b313c9-2b5c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b313c9-2b5c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?