次の2つのエラーが発生しています。角度ルータが未定義
1)ルータ出口コード
import {Routes, RouterModule}from "@angular/router"
@Component({
selector: 'app-root',
template: `
<top-menu></top-menu>
<router-outlet></router-outlet>
`
})
2を以下のための既知の要素ではない)、次のコード
import {Routes, RouterModule} from "@angular/router"
@Component({
selector: 'top-menu',
template: `
<a [routerLink]=['new']> New </a>
<a [routerLink]=['list']> List </a>
`
})
ための予期しない終了タグ<a>
次のようにルートが定義される:
export const routes:Routes = [
{path:'new', component:MyParaComponent},
{path:'list', component:MyListComponent}
];
export const appRouterModule =RouterModule.forRoot(routes);
興味深いことに、app.moのインポートでappRouterModuleを追加するとdule.tsすると、app.routes.ts(appRouterModuleが定義されているファイル)がモジュールをエクスポートしないというエラーが表示されます。
.../app/app.routes"' has no exported member 'appRouterModule'.
すべきですか? – echonax
以下は、Plunkerのカットダウン版へのリンクです - https://plnkr.co/edit/hLME9NSoXeSuLp7MxtGw?p=preview –
簡単にするため、フラグメントや動的IDなどを渡さない場合は、「New」を使用できます –