我正在构建一个角度材料移动应用程序,我需要在其中集成角度材料日历。但是我似乎没有找到适合它的cdn或插件。我发现的教程非常令人困惑,我不希望用bower或npm安装它,而是通过cdn直接调用它。更重要的是,在通过npm安装它的时候,没有适当的文档说明如何调用它们并在角度材料中使用它们。我对于角度js我很新。如果有人能指导我,我真的很感激。 以下链接似乎满足我的要求,但我不知道如何通过cdn将其集成到我的应用程序中,因为它导致错误或无结果
https://github.com/logbon72/angular-material-datetimepicker
答案 0 :(得分:1)
Angular Material Calendar示例:
如果您不想要任何cdn,只需使用浏览器下载所有css / javascript,将其保存在本地并更改其路径。只需使用下面代码中的网址即可。
/**
* Created by intelWorx on 11/11/2015.
*/
(function() {
'use strict';
angular.module('mdDatetimePickerDemo', [
'ngMaterialDatePicker'
])
.controller('DemoCtrl', function($scope) {
$scope.date = new Date();
$scope.time = new Date();
$scope.dateTime = new Date();
$scope.minDate = moment().subtract(1, 'month');
$scope.maxDate = moment().add(1, 'month');
});
})();
<html ng-app="mdDatetimePickerDemo">
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.0-rc3/angular-material.min.css" rel="stylesheet" />
<link href="https://logbon72.github.io/angular-material-datetimepicker/css/material-datetimepicker.css" rel="stylesheet" />
</head>
<body>
<md-content>
<h3>Datepicker only</h3>
<md-input-container class="md-input-has-placeholder">
<label>Start Date/Time</label>
<input time="false" date="true" mdc-datetime-picker="" type="text" id="date" placeholder="Date" ng-model="date" min-date="minDate" max-date="maxDate" class=" md-input">
</md-input-container>
<br />
<h3>Timepicker only(12-hour)</h3>
<md-input-container class="md-input-has-placeholder">
<label>Start Date/Time</label>
<input mdc-datetime-picker="" date="false" time="true" type="text" id="time" short-time="true" placeholder="Time" min-date="minDate" format="hh:mm a" ng-model="time" class=" md-input">
</md-input-container>
<br />
<h3>Timepicker only(24-hour)</h3>
<md-input-container class="md-input-has-placeholder">
<label>Start Date/Time</label>
<input mdc-datetime-picker="" date="false" time="true" type="text" id="time2" placeholder="Time" min-date="minDate" format="HH:mm" ng-model="time" class=" md-input">
</md-input-container>
<br />
<h3>DatepTimePicker</h3>
<md-input-container class="md-input-has-placeholder">
<label>Start Date/Time</label>
<input mdc-datetime-picker="" date="true" time="true" type="text" id="datetime" placeholder="Date" min-date="date" ng-model="dateTime" class=" md-input">
</md-input-container>
<br />
<h3>Date Range Example</h3>
<div class="range layout-column flex-gt-md-30">
<md-input-container class="md-input-has-placeholder">
<label>Start Date/Time</label>
<input mdc-datetime-picker="" date="true" time="true" type="text" placeholder="Date" max-date="dateTimeEnd" ng-model="dateTimeStart" class=" md-input" id="input_0">
</md-input-container>
<md-input-container class="md-input-has-placeholder">
<label>End Date/Time</label>
<input mdc-datetime-picker="" date="true" time="true" type="text" placeholder="Date" min-date="dateTimeStart"="dateTimeEnd" class=" md-input" id="input_1" ng-model="dateTimeEnd">
</md-input-container>
</div>
</md-content>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment-with-locales.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.0-rc3/angular-material.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-aria.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.0-rc3/angular-material.min.js"></script>
<script type="text/javascript" src="https://logbon72.github.io/angular-material-datetimepicker/js/angular-material-datetimepicker.js"></script>
</body>
</html>