我有一个奇怪的问题。我只是想尝试从一个组件导航到另一个组件。我注入了Router等,但由于某种原因,我得到一个没有定义NavigationEnd的错误。我试过这个和那个解决方案,但没有任何作用。任何人都知道可能是什么问题?
这是组件:
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { RouterModule, Router, ActivatedRoute, ParamMap} from '@angular/router';
import { Event, NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
@Component({
selector: 'app-subscribe-box',
templateUrl: './subscribe-box.component.html',
styleUrls: ['./subscribe-box.component.scss']
})
export class SubscribeBoxComponent implements OnInit {
constructor(private http:HttpClient, private route: ActivatedRoute, private router: Router) { }
ngOnInit() {
}
emailSubscribe(email) {
this.router.navigate(["/subscribe-success"]);
}
}