我附上了一個鏈接到Angular日期選擇器的工作版本here。
該應用程序包括以下依存關係:['ngMaterial', 'ngMessages', 'material.svgAssetsCache']
這些都是你必須用CDN的或內部與bower
,node
等
<!-- 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>
這裏外部加載的依賴是要包括HTML代碼日期選擇器:
<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>
確保已加載依賴關係在正確的順序您的應用程序,如:['ngMaterial', 'ngMessages', 'material.svgAssetsCache']
以及在development.js
或production.js
文件取決於您所使用其中環境
這裏是你如何將包括您的個性化CSS主題: (如果不包括主題爲應用程序的配置,然後到您的主題HTML引用將無法正常工作)
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
});
});
工作,thanksss! –