angularjs - jQuery datepicker doens't change ng-empty if I select a date -


i have view in have input field jquery ui date picker.
want disable button if field empty.

html(cshtml-asp.net):

@html.textboxfor(model => model.from, new { ng_model = "from", id = "dfrom", @class = "form-control datepick", placeholder = "select date", tabindex = "2" })   <input ng-disabled="!from" type="button" value="add" class="btn btn-success" /> 

js:

 $(document).ready(function () {         $(function () {             $('.datepick').each(function () {                 $(this).datepicker({ dateformat: 'd mm, y', maxdate: new date() });             });         });     }) 

but if select date, field doesn't change (like: ng-empty ng-not empty) , button still disabled.
how can solve issue?

the ng-disabled makes angular add html disabled='disabled' whenever type selected field (any character other space). works jquery datepicker field.

asp runs on server side. generates code run on client/browser side.

see if following test works you. disables first input field , second button whenever entered third datepicker field (it reverses effect when field becomes blank).

<!doctype html>  <html lang="en">  <head>    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>    <script>      $(function() {         $( "#datepicker" ).datepicker();      });    </script>  </head>  <body>     <div ng-app="">       <input ng-disabled='!mydate' type="text"/><br/><br/><br/>       <input ng-disabled='!mydate' type="button" value="add"/><br/><br/>        <br/><br/><br/><br/>       date:       <input type="text" id="datepicker" ng-model='mydate'>    </div>   </body>  </html>


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -