getting "read property 'length' of undefined" when try to enter date

3670 views javascript

could you please tell me why i am getting this error .

angular.js:12798 TypeError: Cannot read property 'length' of undefined
    at parseDateString (VM651 ui-bootstrap-tpls-2.5.0.js:3037)
    at Array.parseDate (VM651 ui-bootstrap-tpls-2.5.0.js:3062)
    at NgModelController.$$parseAndValidate (VM647 angular.js:25837)
    at NgModelController.$commitViewValue (VM647 angular.js:25827)
    at VM647 angular.js:25970
    at ChildScope.$eval (VM647 angular.js:16374)
    at ChildScope.$apply (VM647 angular.js:16474)
    at NgModelController.$$debounceViewValueCommit (VM647 angular.js:25969)
    at NgModelController.$setViewValue (VM647 angular.js:25941)
    at HTMLInputElement.listener (VM647 angular.js:22200)
(anonymous) @ angular.js:12798
(anonymous) @ angular.js:9545
$apply @ angular.js:16479
$$debounceViewValueCommit @ angular.js:25969
$setViewValue @ angular.js:25941
listener @ angular.js:22200
dispatch @ jquery.js:5183
elemData.handle @ jquery.js:4991

Actually I am trying to enter date without using "datepicker" then I get this error why .how to resolve this error

Step to reproduce this error

  1. Run the application .First date field is empty .I just entered 1 inside that then I will get this error why ?

$scope.changedate =function(){

i also didn't get changed event .

I am making datepicker from here!#datepicker

answered question

1 Answer


You've chosen to supply a collection of alternate date formats but you haven't properly mapped it in your HTML.


<input type="text" ng-change='changedate()' class="form-control" uib-datepicker-popup="{{format}}" ng-model="" is-open="x.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" alt-input-formats="formats" />

You were mapping alt-input-formats to altInputFormats, which isn't defined.

Here's an updated Plunker.

posted this

Have an answer?


Please login first before posting an answer.