[英]I am getting error while integrating bootstrap 4 popover in my angular 2 application
I am using Angular 2 RC 5 version. 我正在使用Angular 2 RC 5版本。 In my angular 2 application I am using system.config.js in that I have mapped ng2-boostrap package like below
在我的angular 2应用程序中,我正在使用system.config.js,因为我已经映射了ng2-boostrap包,如下所示
var map={
'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/ng2-bootstrap',
}
and in app module file i am importing it like below 在应用程序模块文件中,我将其导入如下
import {PopoverModule } from 'ng2-bootstrap/ng2-bootstrap';
@NgModule({
imports: [PopoverModule.forRoot()]
})
Using all of above, still I am getting an error in browser's console as below 使用以上所有内容,仍然在浏览器的控制台中出现如下错误
Error: (SystemJS) Cannot read property 'forRoot' of undefined TypeError: Cannot read property 'forRoot' of undefined at eval ( http://localhost:3000/assets/app.module.js:259:149 ) at execute ( http://localhost:3000/assets/app.module.js:270:14 ) Error loading http://localhost:3000/assets/main.js 错误:(SystemJS)无法读取在执行( http :// localhost:3000 / assets / app.module.js:259:149 )时在eval( http:// localhost:3000 / assets / app.module.js:259:149 )处无法读取的undefined属性'forRoot' :// localhost:3000 / assets / app.module.js:270:14 )加载http:// localhost:3000 / assets / main.js时出错
I am referring this link https://valor-software.com/ng2-bootstrap/index-bs4.html#/popover 我指的是此链接https://valor-software.com/ng2-bootstrap/index-bs4.html#/popover
Not sure about the library you are referring but here are few observations: 不确定您要引用的库,但以下是一些观察结果:
The mentioned library is known to work with Angular 2.x and 4.x and is very simple to use: 提到的库已知可以与Angular 2.x和4.x一起使用,并且使用非常简单:
<button type="button" class="btn btn-secondary" placement="top"
ngbPopover="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." popoverTitle="Popover on top">
Popover on top
</button>
You can see it in action in this minimal plunk (it should help you configure SystemJS and other files in your project): http://plnkr.co/edit/pTZpUjpmAe2Pc1jxO2u0?p=preview 您可以通过最小的操作看到它的实际效果(它应该有助于您在项目中配置SystemJS和其他文件): http ://plnkr.co/edit/pTZpUjpmAe2Pc1jxO2u0?p=preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.