Angular 在角度应用中布线不正常
我试图将路由添加到angular应用程序中,但路由组件在路由器出口处不显示html: app.component.html:Angular 在角度应用中布线不正常,angular,Angular,我试图将路由添加到angular应用程序中,但路由组件在路由器出口处不显示html: app.component.html: <ul> <li><a routerLink="/login">HOME</a></li> <li><a routerLink="/plan">PLAN</a></li> <li><a routerLink="/logi
<ul>
<li><a routerLink="/login">HOME</a></li>
<li><a routerLink="/plan">PLAN</a></li>
<li><a routerLink="/login">HISTORY</a></li>
<li style="float:right"><a routerLink="/login">LOGIN</a></li>
</ul>
<router-outlet></router-outlet>
plan.component.html
<p>plan works!</p>
<p>login works!</p>
计划有效
login.component.html
<p>plan works!</p>
<p>login works!</p>
登录有效
index.html
<!doctype html>
<html lang="en">
<head>
<base href="/">
<meta charset="utf-8">
<title>SnearkyCalories</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
斯内尔基卡洛里酒店
我看到的问题是导航栏覆盖了outlet标签。当我在列表代码下添加一些文本时,应该显示在路由器出口的html就会出现。你说的“不工作”是什么意思。你能提供一个具体的例子吗?这里的问题是什么?都是
RouterModule.forRoot(appRoutes,
和AppRoutingModule
正在使用…你想做一个或另一个,而不是两个。你能包括AppRoutingModule
代码吗?