guillaumebertrand52

Untitled

Mar 24th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. angular.module('stockExchange').controller('StocksController', ['$scope', '$http', 'Stock',
  2. function($scope, $http, Stock) {
  3. $scope.stocks = [];
  4. $http.get('http://127.0.0.1:3000/currencies')
  5. .then(function (response) {
  6. //console.log(response.data);
  7. response.data.quote.forEach(function(data){
  8. var newStock = new Stock({name: data.Name, code: data.Symbol, price: data.Open });
  9. $scope.stocks.push(newStock);
  10. }
  11. );
  12. }, function (error) {
  13. console.log(error)
  14. });
  15. //console.log($scope.stocks);
  16. }]);
Add Comment
Please, Sign In to add comment