Search code examples
angularjsmobiscroll

Mobiscroll: can't bind the timepicker to the scope


Using the 'Mobiscroll' library, i can't get the timepiker selection to bind correctly.

Plunker

My code:

 <div ng-controller="myController">
    {{me}} 
  <input ng-model="me" mobiscroll-instance="timePicker" mobiscroll-time mobiscroll-options="{display: 'modal', theme: 'ios',timeWheels: 'HHii',timeFormat: 'HH:ii',dateFormat: 'HH:ii'}" />

<button ng-click="showTheScroller()">Show</button>




 var myModule = angular.module('myApp', ['mobiscroll-datetime']);

     myModule.controller('myController', ['$scope', function($scope){

       $scope.showTheScroller = function() {
            $scope.timePicker.show();
       };  

 }]); 

I'm trying to bind the result to the scope variable named 'res' but i get a weird date.

Thanks Avi


Solution

  • It is formating issue. You should try this {{res | date:'short'}} Plunker

    FYI, it is not a weird date. It is ISO 8601 datetime format.