简体   繁体   中英

how to add angular tags to html attribute in jquery datepicker

I add jquery datepicker to asp.net mvc5 project . but i couldn't bind angularjs object to it .

 @Html.JQueryUI().Datepicker("date")

how do i bind above controller to angularjs object

eg.

<input type="date" placeholder="Date" data-ng-model="returndate" />

I manage to do that add Jquery to my chtml code.

CHTML

 <input type="date" value="{{ date | date: 'yyyy/MM/dd' }}" placeholder="Departure Date"  data-ng-model="departuredate"/>

JQUERY

@section Scripts{
<script type="text/javascript">
    $(function () {
        $("#txtDepartureDate").datepicker({
            numberOfMonths: 2,
            minDate: -0,
            onSelect: function (selected) {
                var dt = new Date(selected);
                dt.setDate(dt.getDate() + 1);
                $("#txtReturnDate").datepicker("option", "minDate", dt);
            }
        });

    });

</script>}

Thank you, it works now!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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