Wallet/js/routes.js

77 lines
1.8 KiB
JavaScript
Raw Normal View History

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