eventman/angular_app/js/app.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-03-15 18:00:08 +01:00
var eventManApp = angular.module('eventManApp', [
'ngRoute',
2015-03-21 11:34:55 +01:00
'eventManServices',
2015-03-15 18:00:08 +01:00
'eventManControllers'
]);
2015-03-21 15:33:17 +01:00
eventManApp.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
});
};
});
2015-03-15 18:00:08 +01:00
eventManApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/persons', {
templateUrl: 'persons-list.html',
controller: 'PersonsListCtrl'
}).
2015-03-21 15:33:17 +01:00
when('/persons/:id', {
2015-03-15 18:00:08 +01:00
templateUrl: 'person-detail.html',
2015-03-15 23:05:59 +01:00
controller: 'PersonDetailsCtrl'
2015-03-15 18:00:08 +01:00
}).
when('/events', {
templateUrl: 'events-list.html',
controller: 'EventsListCtrl'
}).
2015-03-21 15:33:17 +01:00
when('/events/:id', {
2015-03-15 18:00:08 +01:00
templateUrl: 'event-detail.html',
2015-03-15 23:05:59 +01:00
controller: 'EventDetailsCtrl'
2015-03-15 18:00:08 +01:00
}).
2015-03-21 13:21:47 +01:00
when('/new-event', {
templateUrl: 'event-detail.html',
controller: 'EventDetailsCtrl'
}).
when('/new-person', {
templateUrl: 'person-detail.html',
controller: 'PersonDetailsCtrl'
}).
2015-03-15 18:00:08 +01:00
otherwise({
redirectTo: '/events'
});
}]);