0

I'm trying to use md-datepicker component unfortunately i'm seeing some errors in console.

HTML Code:

<md-datepicker ng-model="vm.addfamilymember.dob" 
               md-placeholder="Date of Birth">
</md-datepicker>

Console Error

angular.min.js:118 Error: The ng-model for md-datepicker must be a Date instance. Currently the model is a: string
    at Error (native)
1
  • Try setting vm.addfamilymember.dob to new Date() in your controller Commented Sep 26, 2016 at 14:42

1 Answer 1

1

$scope.vm.addfamilymember.dob = new Date(); do this in controller

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

1 Comment

Thanks for your suggestion. It worked finally by adding ng-change="vm.addfamilymember.dob = dt.toLocaleDateString()"

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.