I am trying to display a value in angularJS and cannot figure out why it won't print.
I have defined the variable as $scope.totalBTC, and calling it with . Seems straight forward but I cannot make it work.
app.js
app.controller('exchangeValuesController', function($scope, $http) {
$scope.totalBTC = 0;
$scope.exchangeValues = [];
var request = $http.get('/exchange-values');
request.success(function(exchangeValues) {
$scope.exchangeValues = exchangeValues;
$scope.totalBTC = exchangeValues.totalBTC;
console.log('totalBTC: ' + exchangeValues.totalBTC) // totalBTC: 9.45
});
request.error(function(err) {
console.log('Error: ' + err);
});
});
index.ejs
<h1>Poloniex Balances</h1>
<div ng-controller="exchangeValuesController">
<p>
<!-- totalBTC will not print on the ejs page -->
<h1>Total BTC Value: </h1>
</p>
<table class="table">
<tr>
<th>Currency</th>
<th>Amount</th>
<th>rate</th>
<th>Total BTC Value</th>
</tr>
<tr ng-repeat="currency in exchangeValues">
<!-- these values are correctly printing -->
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
How I can make display correctly?
via chuckieDub
No comments:
Post a Comment