var app = angular.module('foodViewApp',['ngRoute','timer','ui.calendar']);app.config(function ($routeProvider){控制台日志(测试");$routeProvider.when('/时间表',{控制器:'调度控制器',templateUrl: 'schedule.html'}).除此以外({重定向到:'/计划'});});
controllers.js:
app.controller('MainController', function($scope, $location, categoryFactory){$scope.isActive = 函数(视图位置){返回 viewLocation === $location.path();};$scope.title = $location.path();});app.controller('ScheduleController', function($scope) {/* 配置对象 */$scope.uiConfig = {日历:{高度:450,可真实,标题:{left: '月基本周基本日议程周议程日',中心:'标题',右:'今天上一个,下一个'},dayClick: $scope.alertEventOnClick,eventDrop: $scope.alertOnDrop,eventResize: $scope.alertOnResize}};var date = new Date();var d = date.getDate();var m = date.getMonth();var y = date.getFullYear();/* 包含作用域上的自定义事件的事件源 */$scope.eventSources = [{title: 'All Day Event',start: new Date(y, m, 1)},{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},{id: 999,title: '重复事件',start: new Date(y, m, d - 3, 16, 0),allDay: false},{id: 999,title: '重复事件',start: new Date(y, m, d + 4, 16, 0),allDay: false},{title: '生日派对',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false}];});
app.controller('MainController', function($scope, $location, categoryFactory){
$scope.isActive = function(viewLocation) {
return viewLocation === $location.path();
};
$scope.title = $location.path();
});
app.controller('ScheduleController', function($scope) {
/* config object */
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
header:{
left: 'month basicWeek basicDay agendaWeek agendaDay',
center: 'title',
right: 'today prev,next'
},
dayClick: $scope.alertEventOnClick,
eventDrop: $scope.alertOnDrop,
eventResize: $scope.alertOnResize
}
};
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
/* event source that contains custom events on the scope */
$scope.eventSources = [
{title: 'All Day Event',start: new Date(y, m, 1)},
{title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
{id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
{id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
{title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false}
];
});