简体   繁体   English

如何将 datepicker js 数据绑定到 angular?

[英]how can i bind datepicker js data to angular?

i try to bind these 2 following files into my Angular project:我尝试将以下 2 个文件绑定到我的 Angular 项目中:

<script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/locales/bootstrap-datepicker.de.min.js'></script>

creating custom JavaScript file in asset and binding it works fine.在资产中创建自定义 JavaScript 文件并将其绑定工作正常。

but where can I bind these 2 files?但是我在哪里可以绑定这两个文件? there have no function name and idk how can I call them in the angular component.没有 function 名称和 IDK 我如何在 angular 组件中调用它们。 (I am new @js) (我是新@js)

i try to add function name to the files (local saved) but it doesn´t work.我尝试将 function 名称添加到文件(本地保存),但它不起作用。 what is the right syntax to add a function name to this files?向此文件添加 function 名称的正确语法是什么?

If what you're trying to do is simply adding a Bootstrap-style date picker in your Angular project, you might be better off using an Angular native component like this one: https://www.npmjs.com/package/@ng-bootstrap/ng-bootstrap如果你想做的只是在你的 Angular 项目中添加一个 Bootstrap 风格的日期选择器,你最好使用像这样的 Angular 本机组件: https://www.npmjs.com/package/@ng -bootstrap/ng-bootstrap

Datepicker demo:https://ng-bootstrap.github.io/#/components/datepicker/overview日期选择器演示:https://ng-bootstrap.github.io/#/components/datepicker/overview

when ever you want to add any external libraries in Angular always looking it in npm first.当你想在 Angular 中添加任何外部库时,总是先在npm中查找它。 Here is a link, hope it'll help you solve your problem, https://www.itsolutionstuff.com/post/angular-8-bootstrap-4-datepicker-exampleexample.html这是一个链接,希望它能帮助您解决问题, https://www.itsolutionstuff.com/post/angular-8-bootstrap-4-datepicker-exampleexample.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM