0
A little while ago I have studied Angularjs through materials like this;
Online Course on YOUTUBE about Angurlajs >>>>> CLICK HERE.
So what he teaches shows that we should link the angular.js file according to the video lessons;
And then I started taking classes and it started working, so I found this demo from Angular;
And with that I tried to implement, but I was not as successful as you can see in this link that I posted on Stackoverflow;
Angular Material Datepicker does not work
I have a colleague of mine who helped me solve and mounted this page as you can see in the code below, and it’s working perfectly;
<html>
<head>
  <title>Lista Telefonica</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Angular Material style sheet -->
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css">
  <style>
    .datepickerdemoBasicUsage {
      /** Demo styles for mdCalendar. */
    }
    .datepickerdemoBasicUsage md-content {
      padding-bottom: 200px;
    }
    .datepickerdemoBasicUsage .validation-messages {
      font-size: 12px;
      color: #dd2c00;
      margin: 10px 0 0 25px;
    }
  </style>
</head>
<body ng-app="myApp">
  <div ng-controller="AppCtrl" style='padding: 40px;' ng-cloak>
    <md-content>
      <h4>Standard date-picker</h4>
      <md-datepicker ng-model="myDate" md-placeholder="Enter date"></md-datepicker>
      <h4>Disabled date-picker</h4>
      <md-datepicker ng-model="myDate" md-placeholder="Enter date" disabled></md-datepicker>
      <h4>Date-picker with min date and max date</h4>
      <md-datepicker ng-model="myDate" md-placeholder="Enter date" md-min-date="minDate" md-max-date="maxDate"></md-datepicker>
      <h4>Only weekends are selectable</h4>
      <md-datepicker ng-model="myDate" md-placeholder="Enter date" md-date-filter="onlyWeekendsPredicate"></md-datepicker>
      <h4>Only weekends within given range are selectable</h4>
      <md-datepicker ng-model="myDate" md-placeholder="Enter date" md-min-date="minDate" md-max-date="maxDate" md-date-filter="onlyWeekendsPredicate"></md-datepicker>
      <h4>With ngMessages</h4>
      <form name="myForm">
        <md-datepicker name="dateField" ng-model="myDate" md-placeholder="Enter date" required md-min-date="minDate" md-max-date="maxDate"
          md-date-filter="onlyWeekendsPredicate"></md-datepicker>
        <div class="validation-messages" ng-messages="myForm.dateField.$error">
          <div ng-message="valid">The entered value is not a date!</div>
          <div ng-message="required">This date is required!</div>
          <div ng-message="mindate">Date is too early!</div>
          <div ng-message="maxdate">Date is too late!</div>
          <div ng-message="filtered">Only weekends are allowed!</div>
        </div>
      </form>
    </md-content>
  </div>
  <!-- Angular Material requires Angular.js Libraries -->
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>
  <!-- Angular Material Library -->
  <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>
  <script>
    angular.module('myApp', ['ngMaterial'])
      .controller('AppCtrl', function($scope) {
          $scope.myDate = new Date();
          $scope.minDate = new Date(
              $scope.myDate.getFullYear(),
              $scope.myDate.getMonth() - 2,
              $scope.myDate.getDate());
          $scope.maxDate = new Date(
              $scope.myDate.getFullYear(),
              $scope.myDate.getMonth() + 2,
              $scope.myDate.getDate());
          $scope.onlyWeekendsPredicate = function(date) {
            var day = date.getDay();
            return day === 0 || day === 6;
          }
    });
  </script>
</body>
</html>
But I was able to notice that he not only included the links from Angularjs but also inserted other links that I don’t imagine he had. You see, I’m a Back-End programmer and by the amazing I understand very little of Frameworks working with Frond-End, and I’m starting to learn Bootstrap now, so bear with me!
The comment I made refers to those parts of the code;
 <!-- Angular Material requires Angular.js Libraries -->
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>
  <!-- Angular Material Library -->
  <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>
I understood that the Appctrl is the controller, I understood that the myapp is the module, but I also did not understand what it is and what the ngMaterial
I don’t know why you’re learning angular. But if it is out of curiosity or some reason that is not a need of your company, dev team, etc. recome than STOP studying angular and start studying angular 2. besides having many improvements it is much easier and organized.
– celsomtrindade