typescript 如何让 jquery ui 日期选择器与 angular2 一起使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35089638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get jquery ui date picker working with angular2?
提问by AngularM
How to get jquery ui date picker working with angular2?
如何让 jquery ui 日期选择器与 angular2 一起使用?
I'm using angular2 and typescript with html5.
我在 html5 中使用 angular2 和 typescript。
I'm trying to add the jquery ui datepicker.
我正在尝试添加 jquery ui datepicker。
I have all the librarys and the css added but the datepicker jquery code is wiring up to the html.
我添加了所有库和 css,但 datepicker jquery 代码连接到 html。
lib: https://jqueryui.com/datepicker/
库:https: //jqueryui.com/datepicker/
Heres my code:
这是我的代码:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<p>Date: <input type="text" id="datepicker"></p>
I've tried putting this in my component : $( "#datepicker" ).datepicker(); But I just get errors.
我试过把它放在我的组件中: $( "#datepicker" ).datepicker(); 但我只是得到错误。
any ideas?
有任何想法吗?
I get this error when I add the project to mine:
将项目添加到我的项目时出现此错误:
采纳答案by Pardeep Jain
Well there are already many datepicker libraries available for the angular2. few of them i have posted below:
那么已经有许多可用于 angular2 的日期选择器库。我在下面发布了其中的一些:
- https://github.com/kekeh/mydatepicker
- https://github.com/jkuri/ng2-datepicker
- http://www.primefaces.org/primeng/#/calendar
- https://github.com/kekeh/mydatepicker
- https://github.com/jkuri/ng2-datepicker
- http://www.primefaces.org/primeng/#/calendar
but yes obviously everyone need stylish datepicker for our project me too want same so i according to need i have created one datepicker using bootflat framework for styling. you can refer here..
但是是的,显然每个人都需要时尚的日期选择器为我们的项目我也想要同样的所以我根据需要我使用 bootflat 框架创建了一个日期选择器来进行样式设置。你可以参考这里..
https://github.com/MrPardeep/Angular2-DatePicker
https://github.com/MrPardeep/Angular2-DatePicker
hope this may help you !
希望这可以帮助你!
回答by Cagatay Civici
PrimeNG also provides a component for DatePicker. Live demo;
PrimeNG 还为 DatePicker 提供了一个组件。现场演示;
回答by vlio20
Here is another one with many configurations, live demo:
https://vlio20.github.io/ng2-date-picker/
这是另一个有很多配置的,现场演示:https:
//vlio20.github.io/ng2-date-picker/
回答by Luke T O'Brien
See this question as a answer of how to use jQuery UI
plugins in your app Whats the best way to use jquery widgets inside angular 2?
将此问题视为如何jQuery UI
在您的应用程序中使用插件的答案在 angular 2 中使用 jquery 小部件的最佳方法是什么?
This example uses ElementRefbut you could also use ViewChild
此示例使用ElementRef但您也可以使用ViewChild
:-)
:-)