title: connecting datetimepicker to angularjs
body: <p>I need to create one input field with date and time using angular + bootstrap.
  I found this <a href="http://tarruda.github.io/bootstrap-datetimepicker/" rel="nofollow">datetime picker</a> it looks excatly i need - date and time in one field, and blocking user wrong editions.
  I writed a directive, datepickers started, but it changes the view and the model doesn't changes... I also tried onSelect, but nothing happens too</p>
  
  <pre><code>&lt;div class="container container-fluid" ng-controller="Ctrl1"&gt;
  2+2={{2+2}}, var1={{var1}}
      &lt;form class="form-horizontal" novalidate name="form" ng-submit="submit()"&gt;
      &lt;div class="well"&gt;
          &lt;div id="date" class="input-append" datetimez ng_model="var1"&gt;
              &lt;input data-format="MM/dd/yyyy HH:mm:ss PP" type="text" id="input1" name="input1" ng_model="var1"&gt;&lt;/input&gt;
      &lt;span class="add-on"&gt;
        &lt;i data-time-icon="icon-time" data-date-icon="icon-calendar"&gt;
        &lt;/i&gt;
      &lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>js</p>
  
  <pre><code>var project = angular.module('project',['ui.bootstrap']);
  
  project.directive('datetimez', function() {
      return {
          restrict: 'A',
          require : 'ngModel',
          link: function(scope, element, attrs, ngModelCtrl) {
              $(function(){
                  element.datetimepicker({
                      dateFormat:'dd/MM/yyyy hh:mm:ss',
                      language: 'pt-BR',
                      onSelect:function (date) {
                          //alert('zz');
                          ngModelCtrl.$setViewValue(date);
                          scope.$apply();
                      }
                  });
              });
          }
      };
  });
  
  project.controller('Ctrl1', ['$scope', '$rootScope',  function(scope, rootScope){
  
      scope.var1="123";
  
  }]);
  </code></pre>
  
  <p>How to fix it? to make connection?</p>