0

How can I bind bootstrap date time picker values to an angular model

My model looks like this:

$scope.Video = {
  StartTime: '',

In my controller my date function looks like this:

    $(function() {
$("#datetimepicker1").datetimepicker();
    });

Here is my html:

<div class='input-group date'  id='datetimepicker1'  >
      <input ng-model="Video.StartTime" type='text' class="form-control" id="inputStartTime" />
     <span class="input-group-addon"><span  class="glyphicon glyphicon-calendar"></span>
      </span>
</div>

When a date is selected form my date picker the input field is populated however my angular model Video.StartTime isn’t assigned the value.

I have tried adding the following to the date picker function which didn’t work: $scope.Video.StartTime = $("#datetimepicker1").value;

1 Answer 1

1

you can use the datepicker directive in angular-ui project

http://angular-ui.github.io/bootstrap/

http://plnkr.co/edit/5SYeKPI0tBAbTgkXnXik?p=preview

Sign up to request clarification or add additional context in comments.

1 Comment

I don't want to change my Ui..I want to use what I have

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.