copay/js/routes.js

80 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-04-07 20:54:38 -07:00
'use strict';
//Setting up route
angular
.module('copayApp')
2014-04-07 20:54:38 -07:00
.config(function($routeProvider) {
$routeProvider
.when('/', {
2014-04-18 15:08:01 -07:00
templateUrl: 'signin.html',
validate: false
2014-04-07 20:54:38 -07:00
})
.when('/signin', {
2014-04-18 15:08:01 -07:00
templateUrl: 'signin.html',
validate: false
2014-04-07 20:54:38 -07:00
})
2014-04-25 13:34:38 -07:00
.when('/import', {
templateUrl: 'import.html',
validate: false
})
2014-04-16 13:07:14 -07:00
.when('/setup', {
2014-04-18 15:08:01 -07:00
templateUrl: 'setup.html',
validate: false
2014-04-16 13:07:14 -07:00
})
.when('/addresses', {
2014-04-21 07:32:51 -07:00
templateUrl: 'addresses.html',
validate: true
2014-04-07 20:54:38 -07:00
})
.when('/join/:id', {
2014-04-18 15:08:01 -07:00
templateUrl: 'join.html',
validate: true
2014-04-07 20:54:38 -07:00
})
.when('/transactions', {
2014-04-18 15:08:01 -07:00
templateUrl: 'transactions.html',
validate: true
2014-04-07 20:54:38 -07:00
})
.when('/send', {
2014-04-18 15:08:01 -07:00
templateUrl: 'send.html',
validate: true
2014-04-07 20:54:38 -07:00
})
.when('/backup', {
2014-04-18 15:08:01 -07:00
templateUrl: 'backup.html',
validate: true
2014-04-07 20:54:38 -07:00
})
2014-05-13 10:19:37 -07:00
.when('/settings', {
templateUrl: 'settings.html',
validate: false
})
2014-05-12 08:00:25 -07:00
.when('/unsupported', {
templateUrl: 'unsupported.html'
})
2014-04-07 20:54:38 -07:00
.otherwise({
templateUrl: '404.html'
});
});
//Setting HTML5 Location Mode
angular
.module('copayApp')
2014-04-07 20:54:38 -07:00
.config(function($locationProvider) {
$locationProvider
.html5Mode(false);
//.hashPrefix('!');
})
.run(function($rootScope, $location) {
2014-04-18 15:08:01 -07:00
$rootScope.$on('$routeChangeStart', function(event, next, current) {
2014-05-12 08:00:25 -07:00
if (!util.supports.data) {
$location.path('unsupported');
} else {
2014-05-12 08:00:25 -07:00
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
$location.path('signin');
}
}
});
2014-05-14 13:20:03 -07:00
})
.config(function($compileProvider) {
2014-05-16 13:35:39 -07:00
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel|chrome-extension|resource):/);
2014-04-07 20:54:38 -07:00
});