1

i like to show the timepicker as a dropdown (popup) in a input element like the datepicker. Is there any easy way to accomplish this or is a complete new directive necessary ?

1 Answer 1

5

HTML

<div class="container container-fluid" ng-controller="MainCtrl">
       var1={{var1}}
      <form class="form-horizontal" novalidate name="form" ng-submit="submit()">
      <div class="well">
        <div id="date" class="input-append" datetimez ng-model="var1">
          <input data-format="hh:mm:ss"  type="text" id="input1" name="input1"></input>
          <span class="add-on">
            <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
          </span>
        </div>
      </div>
  </form>

  </div>

JS

var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.var1 = '12-07-2013';
});


app.directive('datetimez', function() {
    return {
        restrict: 'A',
        require : 'ngModel',
        link: function(scope, element, attrs, ngModelCtrl) {
          element.datetimepicker({           
           language: 'en',
           pickDate: false,          
          }).on('changeDate', function(e) {
            ngModelCtrl.$setViewValue(e.date);
            scope.$apply();
          });
        }
    };
});

Fiddle Demo

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

3 Comments

yeah but i looking for the timepicker as popup
and what is that? its dropdown, see image posted
Opps, you can create directive and use bootstrap timepicker, see my 2nd edit

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.