copay/js/controllers/uriPayment.js

19 lines
646 B
JavaScript
Raw Normal View History

2014-07-01 15:35:15 -07:00
'use strict';
angular.module('copayApp.controllers').controller('UriPaymentController', function($rootScope, $scope, $routeParams) {
2014-07-01 15:49:05 -07:00
var data = decodeURIComponent($routeParams.data);
2014-07-01 15:35:15 -07:00
var splitDots = data.split(':');
$scope.protocol = splitDots[0];
data = splitDots[1];
var splitQuestion = data.split('?');
$scope.address = splitQuestion[0];
var search = splitQuestion[1];
data = JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
function(key, value) {
return key === "" ? value : decodeURIComponent(value);
});
2014-07-01 15:49:05 -07:00
$scope.amount = parseInt(data.amount);
2014-07-01 15:35:15 -07:00
$scope.message = data.message;
});