Angular 2 重复标题 [英] Angular 2 Duplicate Header

查看:19
本文介绍了Angular 2 重复标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 AppComponent 模板中使用 时出现重复标头问题.

Duplicate header issue occurs, while using the <router-outlet></router-outlet> in the AppComponent Template.

我使用的是angular 2.0.0-rc.6"和router 3.0.0-rc.1"

I'm using 'angular 2.0.0-rc.6' and 'router 3.0.0-rc.1'

有人知道为什么会这样吗?

Does anyone have any idea, why is this happening?

推荐答案

应用程序在启动时显示两个标题,因为您的默认路径设置为 AppComponent,其中包含标题.该路径显示在另一个 AppComponent 中,您在 bootstrap 字段中的 app.module.ts 中启动了该组件.您可以通过使用其他组件替换默认路径来解决此问题.

The application is showing two headers on start because your default path is set to be your AppComponent, which has the header included. That path is shown inside of another AppComponent, which you started in your app.module.ts in the bootstrap field. You can resolve this by replacing your default path with another component.

还请确保根据 https://angular 上的最新软件包列表升级您的 package.json.io/guide/quickstart.

这篇关于Angular 2 重复标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆