无法构建Angular项目

时间:2018-03-28 14:39:43

标签: angular ngx-bootstrap

由于完整的引导功能在Angular 2+项目中不起作用。所以我在我的项目中实现了ngx-bootstrap。但现在我得到了错误,而#34; ng -build --prod"命令。

以下是我得到的错误。

任何人都可以帮忙解决这个问题。

chunk {0} styles.6c291e9c3580c6b47b03.bundle.css (styles) 179 kB [initial] [rendered]
chunk {1} polyfills.997d8cc03812de50ae67.bundle.js (polyfills) 84 bytes [initial] [rendered]
chunk {2} main.ee32620ecd1edff94184.bundle.js (main) 84 bytes [initial] [rendered]
chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]

ERROR in src\app\layout\component\header\header.component.html(20,43): : Property 'isCollapsed' does not exist on type 'HeaderComponent'.
src\app\layout\component\header\header.component.html(16,73): : Property 'isCollapsed' does not exist on type 'HeaderComponent'.
src\app\layout\component\header\header.component.html(16,73): : Property 'isCollapsed' does not exist on type 'HeaderComponent'.

< - HTML文件到此处 - >

    你好                 

<div class="collapse navbar-collapse" [collapse]="!isCollapsed">
  <ul class="navbar-nav mr-auto">

        <li dropdown class="nav-item active dropdown border-left border-right " style="font-size:16px!important">
          <a dropdownToggle  class="nav-link dropdown-toggle" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="cursor:pointer">link1</a>
          <div *dropdownMenu  class="dropdown-menu" aria-labelledby="dropdown01">
            <a class="dropdown-item" routerLink="/link2">link2</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" routerLink="/link3">link3 Details</a>
            <a class="dropdown-item" routerLink="/link4">link4</a>
          </div>
        </li>

        <li class="nav-item  active border-right  " style="font-size:16px!important">
            <a class="nav-link " routerLink="/link5">link5</a>
          </li>
  </ul>
</div>

1 个答案:

答案 0 :(得分:3)

如果要在HTML视图中使用,则必须在TypeScript类isCollapsed中声明属性HeaderComponent

前:

public isCollapsed: boolean;

否则,您可以在模板&#34; header.component.html&#34;中删除您的媒体资源isCollapsed的所有来电。

import { Component } from '@angular/core'; 
@Component({ 
selector: 'toggle-manual-demo', 
templateUrl: './toggle-manual.html' 
}) 

export class ToggleManualDemoComponent { 
    isCollapsed = false; 
}