现在的位置: 首页 > 综合 > 正文

angular directive ngmodel with jquery ui datepicker

2018年05月22日 ⁄ 综合 ⁄ 共 302字 ⁄ 字号 评论关闭
  1. app.directive('datepicker',
    function()
    {
  2. return
    {
  3. restrict:
    'A',
  4. require
    :
    'ngModel',
  5. link
    :
    function
    (scope,
    element
    , attrs,
    ngModelCtrl
    )
    {
  6. $(function(){
  7. element.datepicker({
  8. dateFormat:'dd/mm/yy',
  9. onSelect:function
    (date)
    {
  10. scope.$apply(function
    ()
    {
  11. ngModelCtrl.$setViewValue(date);
  12. });
  13. }
  14. });
  15. });
  16. }
  17. }
  18. });

<input ng-model="property"....

抱歉!评论已关闭.