我正在尝试使用 Accordion 库中的 Ng-Lightning 组件。
我的 html:
<ul ngl-accordion [(activeName)]="active">
<ng-template nglAccordionSection name="B" label="Accordion Title A">This is the content area for section A
</ng-template>
</ul>
<div class="slds-m-top_large">Active Section Name: <b>{{ active | json }}</b></div>
和我的组件文件:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-list-item',
templateUrl: './list-item.component.html',
styleUrls: ['./list-item.component.scss']
})
export class SuggestedReferenceListItemComponent implements OnInit {
active='B';
constructor() { }
ngOnInit(): void {}
}
我在尝试编译代码时看到以下警告:
Error: src/app/list-item/list-item.component.html:3:35 - error TS2322: Type 'string | string[]' is not assignable to type 'string'.
Type 'string[]' is not assignable to type 'string'.
<ul ngl-accordion [(activeName)]="active">
谁能告诉我为什么我会看到该警告以及如何解决它?