Bootstrap 3 Datepicker in Angular 2+ with or without jquery

馋奶兔 提交于 2019-12-06 08:46:14

you need to add: declare var $:any;

declare var $: any;

@Component({
    ...
})

Be sure to have all required librairies in your librairies:

npm install jquery bootstrap moment eonasdan-bootstrap-datetimepicker--save

then in angular-cli.json

"styles": ["../node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css"],
"scripts": [
      "../node_modules/jquery/dist/jquery.js",
      "../node_modules/bootstrap/dist/js/bootstrap.js",
      "../node_modules/moment/moment.js",
      "../node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js",
      ...

And you dont need to add these in scripts tags in index.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!