我无法让Accordion组件发挥作用。我在app.module.ts中有这个:
//ng2-bootstrap
import { AccordionModule } from "ng2-bootstrap";
@NgModule({
declarations: [...],
imports: [
BrowserModule,
HttpModule,
FormsModule,
...
AccordionModule
]...
我正在使用systemjs模块,所以我的配置是:
var map = {
'app': 'app', // 'dist',
'@angular': 'dist/lib/@angular',
'moment': 'dist/lib/moment/min/moment.min.js',
'ng2-bootstrap': 'dist/lib/ng2-bootstrap',
'angular2-in-memory-web-api': 'dist/lib/angular2-in-memory-web-api',
'rxjs': 'dist/lib/rxjs',
'ag-grid-ng2': 'dist/lib/ag-grid-ng2',
'ag-grid-enterprise': 'dist/lib/ag-grid-enterprise',
'ag-grid': 'dist/lib/ag-grid'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'ng2-bootstrap': {
format: 'cjs',
main: 'bundles/ng2-bootstrap.umd.js',
defaultExtension: 'js'
},...
我的一个组件中有这个标记:
<accordion>
<accordion-group heading="Static Header, initially expanded"
[isOpen]="status.isFirstOpen"
[isDisabled]="status.isFirstDisabled">
This content is straight in the template.
</accordion-group>
</accordion>
Angular 2对我的标记不满意。它无法弄清楚如何处理Accordion标记:
Unhandled Promise rejection: Template parse errors:
Can't bind to 'isOpen' since it isn't a known property of 'accordion-group'.
1. If 'accordion-group' is an Angular component and it has 'isOpen' input, then verify that it is part of this module.
谁能看到我做错了什么?我已经接近放弃了这个图书馆。 感谢。
答案 0 :(得分:0)
请升级您的ngx-bootstrap
npm i ngx-bootstrap@2.0.5 --save
或
npm i ngx-bootstrap@4.2.0 --save