I have created 2 different projects using angular-cli
. Both work perfectly but in one of them routeConfig
is null
and have no idea what's wrong.
The package.json
of both file are the same so there's no any doubt about packages versions, app.modules
files are the same as well.
Here is how I get routeConfig
in both projects :
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
constructor(
private router: ActivatedRoute
) { }
ngOnInit(): void {
console.log(this.router.routeConfig);
}
}
what's wrong with my implementation?