Merge pull request #195 from colkito/bug/initial-currency-values-setted

initial currency values setted on header controller
This commit is contained in:
Gustavo Maximiliano Cortez 2014-02-07 16:47:18 -02:00
commit 098c814bc8
2 changed files with 26 additions and 25 deletions

View File

@ -3,11 +3,13 @@
angular.module('insight.currency').controller('CurrencyController', angular.module('insight.currency').controller('CurrencyController',
function($scope, $rootScope, Currency) { function($scope, $rootScope, Currency) {
$rootScope.currency = { var _roundFloat = function(x, n) {
factor: 1, if(!parseInt(n, 10) || !parseFloat(x)) n = 0;
bitstamp: 0,
symbol: 'BTC', return Math.round(x * Math.pow(10, n)) / Math.pow(10, n);
getConvertion: function(value) { };
$rootScope.currency.getConvertion = function(value) {
if (typeof value !== 'undefined' && value !== null) { if (typeof value !== 'undefined' && value !== null) {
var response; var response;
@ -25,13 +27,6 @@ angular.module('insight.currency').controller('CurrencyController',
} }
return 'value error'; return 'value error';
}
};
var _roundFloat = function(x, n) {
if(!parseInt(n, 10) || !parseFloat(x)) n = 0;
return Math.round(x * Math.pow(10, n)) / Math.pow(10, n);
}; };
$scope.setCurrency = function(currency) { $scope.setCurrency = function(currency) {

View File

@ -4,6 +4,12 @@ angular.module('insight.system').controller('HeaderController',
function($scope, $rootScope, getSocket, Global, Block) { function($scope, $rootScope, getSocket, Global, Block) {
$scope.global = Global; $scope.global = Global;
$rootScope.currency = {
factor: 1,
bitstamp: 0,
symbol: 'BTC'
};
$scope.menu = [ $scope.menu = [
{ {
'title': 'Blocks', 'title': 'Blocks',