0

我的角度应用程序有问题。我收到此错误:

[Error] ERROR – TypeError: undefined is not an object (evaluating 'this.body.toggle')

在 Chrome 控制台中,这指的是以下 HTML 部分:

<mdb-accordion-item *ngFor="let item of menuitems" [ngClass]="{'no-collase': item.submenu.length == 0}">
                    <mdb-accordion-item-head mdbWavesEffect>
                        <fa-icon [icon]="item.icon" class="icon"></fa-icon> {{ 'webapp.menu.' + item.key | translate:lang }}
                    </mdb-accordion-item-head>
                    <mdb-accordion-item-body *ngIf="item.submenu.length != 0">
                            <ul>
                                <li *ngFor="let subitem of item.submenu"> 
                                    <a class="nav-link waves-light" mdbWavesEffect routerLink="{{subitem.routerlink}}">
                                        <fa-icon [icon]="subitem.icon" class="icon"></fa-icon>
                                        <span class="clearfix d-none d-sm-inline-block">{{ 'webapp.menu.' + subitem.key | translate:lang }}</span>
                                    </a>
                                </li>
                            </ul>
                        </mdb-accordion-item-body>
                </mdb-accordion-item>

我的“menuitems”数组如下所示:

menuitems:any[] = [
    {key: "dashboard", routerlink: "/settings", icon: this.faDashboard, submenu: []},
    {key: "settings", routerlink: "/settings", icon: this.faCog, submenu: []}
  ];

也许有人有一个想法可以帮助我......我在专业版中使用 MDBootstrag for Angular。

4

0 回答 0