我有通过npm安装ng2-eonasdan-datetimepicker的问题,我把行放在angular-cli
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/font-awesome/css/font-awesome.css",
"../node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/popper.js/dist/popper.min.js",
"../node_modules/popper.js/dist/umd/popper-utils.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"
我把这个导入也放在app.module
中import {A2Edatetimepicker} from 'ng2-eonasdan-datetimepicker';
imports: [
BrowserModule,
A2Edatetimepicker
]
这是我的模板
<div class="form-group">
<div class="input-group">
<input class="form-control"
a2e-datetimepicker
[date]="date"
[options]="a2eOptions"
(onChange)="dateChange($event)"
(onClick)="dateClick()"
/>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
我基于eonasdan-datetimepicker的这个例子
https://embed.plnkr.co/vnU3TedIRqOFGXWRbXt0/
我在控制台中有这个错误
this.dpElement.datetimepicker is not a function
我不知道如何处理它,所以我需要你的帮助
提前致谢