Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('stockExchange').controller('StocksController', ['$scope', '$http', 'Stock',
- function($scope, $http, Stock) {
- $scope.stocks = [];
- $http.get('http://127.0.0.1:3000/currencies')
- .then(function (response) {
- //console.log(response.data);
- response.data.quote.forEach(function(data){
- var newStock = new Stock({name: data.Name, code: data.Symbol, price: data.Open });
- $scope.stocks.push(newStock);
- }
- );
- }, function (error) {
- console.log(error)
- });
- //console.log($scope.stocks);
- }]);
Add Comment
Please, Sign In to add comment