【发布时间】:2020-07-23 07:51:54
【问题描述】:
我正在尝试将 Bulma carousel https://github.com/wikiki/bulma-carousel 导入 Angular 10 应用程序。
-
我已经通过 angular.json 导入了 javascript。
-
在要显示轮播的组件中,我尝试导入类并访问它
import {bulmaCarousel} from 'bulma-carousel'; ... ngOnInit(): void { this.carousel = bulmaCarousel.attach('#carousel-demo', { slidesToScroll: 1, slidesToShow: 4 });
我收到一条错误消息
TypeError: Cannot read property 'attach' of undefined at HomeComponent.ngOnInit (http:
如果我尝试将其随机导入 app.module
import {bulmaCarousel} from 'bulma-carousel';
...
imports [
bulmaCarousel
我明白了
ERROR in src/app/app.module.ts:71:12 - error NG1010: Value at position 16 in the NgModule.imports of AppModule is not a reference: [object Object]
【问题讨论】: