无法在延迟加载组件中加载页眉,页脚组件(Angular 5)

时间:2018-04-23 14:34:31

标签: angular

在我的angular 5项目中,我有FooterComponent declarations: [.... HeaderComponent,FooterComponent.....] 和一些延迟加载模块。

在app.modules.ts

....
 @Component({
      selector: 'ls-header',
      templateUrl: './header.component.html',
      styleUrls: ['./header.component.css']
    })
@Input() public showHome: string = "N";
....

在header.component.ts

......
    <ls-header [showHome]="'Y'" [showLogout]="'Y'" ></ls-header>
......

在lazyLoad.component.ts

Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'showHome' since it isn't a known property of 'header'.

我正在尝试访问网址(延迟加载)而我正在

<head>
    <meta name="WT.cg_n" content="Loginsider">
    <meta name="DCSext.loginPage" content="Logg inn - Din side">
    <meta content="no" http-equiv="Content-Language">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script type="text/javascript" src="javascript/xmlhttp.js"></script>
    <link rel="stylesheet" type="text/css" href="_public/gjeff/css/gjeff.css"/>
    <script type="text/javascript" src="_public/gjeff/js/gjeff.min.js"></script>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/html5shiv.js"></script>
    <script type="text/javascript" src="static/respond.min.js"></script>
    <![endif]-->
    <script language="JavaScript" src="javascript/dummy_bid20_xxx.js" type="text/javascript"></script>
    <meta name="bid_kid" content="17RA18B5YKIU6A89PIZ6ED0ZYRV1KH">
    <meta name="ajaxurl" content="../no/0/ajax/loginpage-bankid">
    <script src="javascript/init_bid_helper_proto.js" type="text/javascript" defer></script>

    <title>Logg inn - here</title>
</head>

2 个答案:

答案 0 :(得分:0)

如果你调用标题组件,你应该有这样的东西:

<ls-header [showHome]="inputValue"></ls-header>

答案 1 :(得分:0)

正如您所看到的,您的选择器为selector: 'ls-header',而不是header,这是您应该在标记中使用的

  <ls-header [showHome]="'Y'" [showLogout]="'Y'" ></ls-header>