I have an import:
import { RouterModule, Routes} from '@angular/router';
and then I used the line below in my function inside the component
this.router.navigate(['/dashboard']);
/* Missing if you are using 'this.router.navigate' */ import { Router } from '@angular/router';
You need to pass it inside the constructor , as shown below,
constructor
constructor(private router: Router){ }
Also make sure you import the Router as shown below.
Router
import { Router } from '@angular/router';
Source: https://habr.com/ru/post/1269428/More articles:How to import javascript package from cdn / script tag in React? - javascriptAzure function execution speed is extremely slow and inconsistent - javascriptCould not start solr using Java 9 - javaPermission denied while trying to install elm with sudo on ubuntu - node.jsAngular 4 - ERROR TypeError, ERROR CONTEXT DebugContext_ - jsontf.variable vs tf.constant in tensor flow - tensorflowMultiple activity or single activity and several fragments - android3D python cube - pythonPython pyramid 3 - pythonSpring boot 2 @Transactional annotation makes Autowired fields null - javaAll Articles