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

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

问题描述

在AppComponent模板中使用<router-outlet></router-outlet>时,出现重复标头问题.

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 .

Please also make sure to upgrade your package.json according to the latest package list at https://angular.io/guide/quickstart.

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

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