ffffng/app/scripts/app.js
2016-05-16 18:27:03 +02:00

59 lines
1.5 KiB
JavaScript

'use strict';
angular.module('ffffng', [
'ngSanitize',
'ngRoute',
'ng',
'leaflet-directive',
'templates-main',
'ui.bootstrap'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl',
title: 'Willkommen'
})
.when('/new', {
templateUrl: 'views/newNodeForm.html',
controller: 'NewNodeCtrl',
title: 'Neuen Knoten anmelden'
})
.when('/update', {
templateUrl: 'views/updateNodeForm.html',
controller: 'UpdateNodeCtrl',
title: 'Knotendaten ändern'
})
.when('/delete', {
templateUrl: 'views/deleteNodeForm.html',
controller: 'DeleteNodeCtrl',
title: 'Knoten löschen'
})
.otherwise({
redirectTo: '/'
});
})
.service('Navigator', function ($location) {
return {
home: function () {
$location.url('/');
},
newNode: function () {
$location.url('/new');
},
updateNode: function () {
$location.url('/update');
},
deleteNode: function () {
$location.url('/delete');
}
};
})
.run(function ($location, $rootScope, config) {
$rootScope.$on('$routeChangeSuccess', function (event, current) {
$rootScope.title = current.$$route.title;
$rootScope.config = config;
});
});