似乎我的问题是添加脚本的顺序,以及我删除了“moment-withh-locales.js”脚本的顺序。
我现在的订单是:
<script src="scripts/angular.min.js" type="text/javascript"></script>
<script src="scripts/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="scripts/jquery.easing.min.js" type="text/javascript"></script>
<script src="scripts/angular-route.js"></script>
<script src="scripts/moment-with-locales.js" type="text/javascript"></script>
<script src="scripts/moment.min.js" type="text/javascript"></script>
<script src="scripts/angular-moment-picker.min.js" type="text/javascript"></script>
<link href="css/angular-moment-picker.min.css" rel="stylesheet" type="text/css"/>
<script src="scripts/app.js" type="text/javascript"></script>
在 app.js 我的代码如下:
var app = angular.module('weather', ['ngRoute', 'moment-picker']);
app.config(function($routeProvider)
{
$routeProvider
.when("/", {
templateUrl : "home.php"
})
.when("/page1", {
templateUrl : "page1.php"
});
});
app.config(['momentPickerProvider', function (momentPickerProvider) {momentPickerProvider.options(
{
/* Picker properties */
locale: 'en',
format: 'L LTS',
minView: 'decade',
maxView: 'minute',
startView: 'year',
autoclose: true,
today: false,
keyboard: false,
/* Extra: Views properties */
leftArrow: '←',
rightArrow: '→',
yearsFormat: 'YYYY',
monthsFormat: 'MMM',
daysFormat: 'D',
hoursFormat: 'HH:[00]',
minutesFormat: moment.localeData().longDateFormat('LT').replace(/[aA]/, ''),
secondsFormat: 'ss',
minutesStep: 5,
secondsStep: 1
});
}]);
谢谢大家的帮助。