Material angular datepicker not working

Asked

Viewed 290 times

0

I’m using Angular Material in a project and need to collect the user’s date of birth in the register, I am trying to use the Datepicker of Material, but the field doesn’t even appear on the screen. I’m doing what’s wrong?

HTML:

<div layout-gt-xs="row">
    <div flex-gt-xs>
        <label>Data de nascimento</label>
        <md-datepicker ng-model="birth" md-placeholder="Data de nascimento"></md-datepicker>
    </div>
</div>

Javascript:

$scope.user.birth = new Date();

$scope.minDate = new Date(
    $scope.birth.getFullYear(),
    $scope.birth.getMonth() - 2,
    $scope.birth.getDate());

$scope.maxDate = new Date(
    $scope.birth.getFullYear(),
    $scope.birth.getMonth() + 2,
    $scope.birth.getDate());

$scope.onlyWeekendsPredicate = function(date) {
    var day = date.getDay();
    return day === 0 || day === 6;
};
  • There is some error in the console?

  • No error in the console, the datepicker field simply does not appear, but loads into html

  • Imported all necessary libs? I ran a jsfiddle test and it appeared at first

  • https://jsfiddle.net/suunyz3e/328/

  • @Diegoaugusto actually I was using a wrong version, but thank you.

1 answer

4


I managed to solve it. In my case I was using a wrong version of material, follows the Imports I made:

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/0.11.1/angular-material.min.css">

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.1/angular-material.min.js"></script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.