angular - 如何在 Angular 7 中包含 boomerangjs 脚本文件?
问题描述
我正在尝试在我的 Angular 代码中实现 boomerangjs。但这对我不起作用。我需要你的帮助来解决它。下面是我使用它的方式。所以首先我使用 npm 安装了 boomerangjs,现在它可以在我的 node_modules 中使用。我的第一页是dashboard.component.ts,所以我在这个组件中添加了下面的代码。
import {BOOMR} from 'node_modules/boomerangjs';
export class DashboardComponent implements OnInit {
ngOnInit() {
BOOMR.init({
beacon_url: "/beacon"
});
}
}
但是我收到TypeError: Cannot read property 'init' of undefined
错误。请帮助我如何在我的角度代码中使用“boomerangjs”。
编辑 1 - 我可以在列出导入的页面顶部看到 3 个点 ...。当我将鼠标悬停在以下消息的点上时:
Could not find a declaration file for module 'node_modules/boomerangjs'. 'd:/code/node_modules/boomerangjs/boomerang.js' implicitly has an 'any' type.
Try `npm install @types/boomerangjs` if it exists or add a new declaration (.d.ts) file containing `declare module 'boomerangjs';`
谢谢
解决方案
推荐阅读
- checkbox - 当我点击输入类型标签=“复选框”第一个状态“假”
- java - Java/Mysql 从一个表中选择主键值并将它们作为外键插入到另一个表中
- ruby - 如何更改 GEM 包管理器版本,而不是特定的 gem/module/package
- android - 在非标准构建类型的情况下,androidTest 依赖项的未解析符号
- r - 如何展平非原子函数结果,以便可以将其分配为 dplyr mutate 步骤的一部分?
- dictionary - 以字符串为键和任何值的字典
- python - 什么是线性池化层?
- angular - 我如何从角度组件调用 HTML 标记函数
- javascript - 如何从网站下载嵌入式视频?
- installation - LoadRunner 2020 安装中的致命错误