jQuery的日期选择器选择的日期不NG-变化考虑 - AngularJS [英] Jquery datepicker selected date is not considered in ng-change - AngularJS

查看:138
本文介绍了jQuery的日期选择器选择的日期不NG-变化考虑 - AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决这个问题。
我使用jQuery日期选择器与AngularJS。我试图让选定的日期,并用函数的参数传递。对于此,我用下面的code。

HTML:

 <输入类型=文本NG模型=gettingStartDateNG变化=newTest(gettingStartDate)/>

日期选取器:

  $(#日期1).datepicker();

AngularJS:

 函数getOrg($范围,$ HTTP){  $ scope.newTest =功能(开始){
     警报(开始);
  };}


解决方案

这种复杂的UI组件需要

被包裹成一个指令,以保持模型数据绑定。对于jQuery的日期选择器,可以检查这个问题或Google围绕jQuery的日期选择器指令

Kindly help me to solve this issue. I am using jquery datepicker with AngularJS. I am trying to get the selected date and pass it with a function as parameter. For this I am using the following code.

Html:

<input type="text" "ng-model="gettingStartDate" ng-change="newTest(gettingStartDate)" />

Date Picker:

$( "#date1" ).datepicker();

AngularJS:

function getOrg($scope, $http) {

  $scope.newTest = function(start_date){
     alert(start_date); 
  };

}

解决方案

Such complex UI components need to be wrapped into a directive to maintain a model data binding. For the jQuery datepicker, you can check this question, or google around "jquery datepicker directive".

这篇关于jQuery的日期选择器选择的日期不NG-变化考虑 - AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆