Argument of type 'string[]' is not assignable to parameter of type 'string

#1

Hello I need to navigate to another page using angular routing but I’m facing a typescript issue.
Here what I have:

import { Component } from '@angular/core';
import { Router } from '@angular/router';


@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  constructor(private router: Router) {
    openWelcomePage() {
      this.router.navigateByUrl(['/welcome']);
    }
  }
}

And the output is:
Screenshot_2019-01-27_22-21-13

I tried unistalling typescript and installing the latest version, but didn’t worked.

#2

Hello,
its late, so only a quick look.
Is methode openWelcomePage() inside constructor? If yes, move it outside of constructor and call it anywhere you want.

Late regards, anna-liebt

#3

Oh yes you was right.I was inside constructor and now is working fine.
Thanks