0

Im creating a tablet app and i need put DatePicker like AngularJS Demos (https://material.angularjs.org/latest/demo/input) but it is not working, see the picture:

enter image description here

im put the css from Angular Material:

<link href="resource/css/angular-material.min.css" rel="stylesheet">

There is other problem, the layout directive is not working, i think it is the same problem.

Thanks Argate

2 Answers 2

2

I have attached a link to a working version of the Angular date picker here.

The app includes the following dependencies: ['ngMaterial', 'ngMessages', 'material.svgAssetsCache']

These are the dependencies you must load externally with CDN's or internally with bower, node etc.

 <!-- Angular Material requires Angular.js Libraries -->
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>

Here is the HTML code you want to include the date-picker:

<div ng-controller="AppCtrl" ng-cloak="" class="datepickerdemoBasicUsage" ng-app="MyApp">
    <md-content layout-padding="">

        <div layout-gt-xs="row">
            <div flex-gt-xs="">
                <h4>Standard date-picker</h4>
                <md-datepicker ng-model="myDate" md-placeholder="Enter date"></md-datepicker>
            </div>
    </md-content>
</div>

Make sure you have loaded the dependencies in your app in the correct order, e.g: ['ngMaterial', 'ngMessages', 'material.svgAssetsCache'] as well as in your development.js or production.js file depending which environment you are working in.

Here is how you would include your personalised CSS theme: (If you do not include the theme as a config of the app then your HTML references to the theme will not work)

angular.module('myApp', ['ngMaterial'])
.config(function($mdThemingProvider) {

  $mdThemingProvider.theme('default')
    .primaryPalette('pink', {
      'default': '400', // by default use shade 400 from the pink palette for primary intentions
      'hue-1': '100', // use shade 100 for the <code>md-hue-1</code> class
      'hue-2': '600', // use shade 600 for the <code>md-hue-2</code> class
      'hue-3': 'A100' // use shade A100 for the <code>md-hue-3</code> class
    })
    // If you specify less than all of the keys, it will inherit from the
    // default shades
    .accentPalette('purple', {
      'default': '200' // use shade 200 for default, and keep all other shades the same
    });

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

Comments

1

Could be a number of things, this is a layout that works:

<md-content flex layout-padding>
  <div layout="row" layout-align=" start center">
    <md-datepicker ng-model="App" md-placeholder="date" flex></md-datepicker>
  </div>
</md-content>

Example:

Angular Material App Layout

You might want to do a pen or fork the above and try to recreate your issue.

Comments

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.