mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
Converts enabled-exchanges to a component
This commit is contained in:
29
web/app/components/enabled-exchanges/enabled-exchanges.js
Normal file
29
web/app/components/enabled-exchanges/enabled-exchanges.js
Normal file
@@ -0,0 +1,29 @@
|
||||
angular.module('myApp.enabledExchanges', []).component('enabledexchanges', {
|
||||
templateUrl: '/components/enabled-exchanges/enabled-exchanges.html',
|
||||
controller: 'EnabledExchangesController',
|
||||
controller: function($scope, $http, Notification, $rootScope) {
|
||||
$scope.selected = {};
|
||||
$scope.getDashboardData = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: '/data/all-enabled-currencies'
|
||||
}).
|
||||
success(function(data, status, headers, config) {
|
||||
$scope.exchanges = data.data;
|
||||
$scope.reloadDashboardWithExchangeCurrency($scope.exchanges[0], $scope.exchanges[0].exchangeValues[0]);
|
||||
Notification.info("Retrieved latest data");
|
||||
}).
|
||||
error(function(data, status, headers, config) {
|
||||
console.log('error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reloadDashboardWithExchangeCurrency = function(exchange, value) {
|
||||
$scope.selected.Exchange = exchange;
|
||||
$scope.selected.Currency = value;
|
||||
$rootScope.$emit('CurrencyChanged', $scope.selected);
|
||||
|
||||
};
|
||||
$scope.getDashboardData();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user