1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-12 12:15:07 -05:00
mail/src/js/app.js

68 lines
2.3 KiB
JavaScript
Raw Normal View History

// hey Angular, we're bootstrapping manually!
window.name = 'NG_DEFER_BOOTSTRAP!';
2013-09-11 15:01:05 -04:00
require([
'angular',
'js/controller/dialog',
'js/controller/popover',
2013-10-21 11:10:45 -04:00
'js/controller/account',
'js/controller/login',
2013-10-21 07:10:42 -04:00
'js/controller/login-initial',
'js/controller/login-new-device',
'js/controller/login-existing',
'js/controller/mail-list',
'js/controller/read',
2013-09-11 15:01:05 -04:00
'js/controller/write',
2013-09-17 13:11:30 -04:00
'js/controller/navigation',
2013-11-27 04:40:55 -05:00
'cryptoLib/util',
2013-09-11 15:01:05 -04:00
'angularRoute',
'angularTouch'
], function(angular, DialogCtrl, PopoverCtrl, AccountCtrl, LoginCtrl, LoginInitialCtrl, LoginNewDeviceCtrl, LoginExistingCtrl, MailListCtrl, ReadCtrl, WriteCtrl, NavigationCtrl, util) {
'use strict';
2013-11-27 04:40:55 -05:00
// reset window.name
window.name = util.UUID();
// init main angular module including dependencies
var app = angular.module('mail', ['ngRoute', 'ngTouch', 'navigation', 'mail-list', 'write', 'read', 'login-new-device', 'popover']);
// set router paths
app.config(function($routeProvider) {
$routeProvider.when('/login', {
2013-11-04 08:20:14 -05:00
templateUrl: 'tpl/login.html',
controller: LoginCtrl
});
2013-10-21 07:10:42 -04:00
$routeProvider.when('/login-existing', {
templateUrl: 'tpl/login-existing.html',
controller: LoginExistingCtrl
});
$routeProvider.when('/login-initial', {
templateUrl: 'tpl/login-initial.html',
controller: LoginInitialCtrl
});
$routeProvider.when('/login-new-device', {
templateUrl: 'tpl/login-new-device.html',
controller: LoginNewDeviceCtrl
});
2013-09-17 13:11:30 -04:00
$routeProvider.when('/desktop', {
templateUrl: 'tpl/desktop.html',
controller: NavigationCtrl
});
2013-09-06 18:34:36 -04:00
$routeProvider.otherwise({
2013-09-19 09:41:21 -04:00
redirectTo: '/login'
2013-09-06 18:34:36 -04:00
});
});
// inject controllers from ng-included view templates
app.controller('ReadCtrl', ReadCtrl);
app.controller('WriteCtrl', WriteCtrl);
app.controller('MailListCtrl', MailListCtrl);
2013-10-21 11:10:45 -04:00
app.controller('AccountCtrl', AccountCtrl);
app.controller('DialogCtrl', DialogCtrl);
app.controller('PopoverCtrl', PopoverCtrl);
// manually bootstrap angular due to require.js
angular.element().ready(function() {
angular.bootstrap(document, ['mail']);
});
});