Poornima Poornima - 1 year ago
454 0

I write code for getting input value and with that i need to route next page,

But it showing " Cannot read property 'params' of undefined", in this version "Params" only accepted in @angular/router,

If i call ngOninit, then it showing error, please help me to solve the issue.


Angular Unit testing

import { ActivatedRoute, Params,Router } from '@angular/router';

  ngOnInit(): void {
        this.movieName = this.activatedRoute.snapshot.params['movie1name'];
            if (this.movieName !== undefined) {
                this.lblName = "Second Movie";
            //this.movieName = params['movie1name'];
            this.navigated = true;
            } else {
                this.lblName = "First Movie";
            this.navigated = false;            
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download