I am getting following two errors.
1) router-outlet is not a known element for following code
import {Routes, RouterModule}from "@angular/router"
@Component({
selector: 'app-root',
template: `
<top-menu></top-menu>
<router-outlet></router-outlet>
`
})
2) Unexpected closing tag <a> for following code
import {Routes, RouterModule} from "@angular/router"
@Component({
selector: 'top-menu',
template: `
<a [routerLink]=['new']> New </a>
<a [routerLink]=['list']> List </a>
`
})
The routes are defined as follows:
export const routes:Routes = [
{path:'new', component:MyParaComponent},
{path:'list', component:MyListComponent}
];
export const appRouterModule =RouterModule.forRoot(routes);
Interestingly, if I add appRouterModule in imports in app.module.ts then I get an error that app.routes.ts (the file where appRouterModule) is defined doesn't export any module.
.../app/app.routes"' has no exported member 'appRouterModule'.
@NgModule's look like?