Ejemplo 1: Si ‘router-outlet’ es un componente angular, verifique que sea parte de este módulo.
@NgModule({
imports: [
BrowserModule,
RouterModule
Ejemplo 2: ‘router-outlet’ no es un elemento conocido
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import {DashboardComponent} from "./dashboard/dashboard.component"
const appRoutes: Routes = [
{
path: '',
redirectTo: '/dashboard',
pathMatch: 'full',
component: DashboardComponent
},
{
path: 'dashboard',
component: DashboardComponent
}
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes),
BrowserModule,
FormsModule
],
exports: [RouterModule],
declarations: [
AppComponent,
DashboardComponent
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Ejemplo 3: router-outlet ‘no es un elemento angular conocido
@NgModule({
imports: [
BrowserModule,
RouterModule
],
exports : [RouterModule]
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)