I am trying to add the json data to a table on clicking the + icon. There are 2 section namely Pick Stocks from where the stocks and price (which inturn are coming from data.json) has to be added to the table present in Manage Portfolio section.
Second Section
So I want the stock name i.e. ADFI, ALAN etc and its respective price to be added to respective stock and price columns of table in second section when a respective + icon is clicked.
I have tried adding but I am not entirely sure about how to go forward.
Thank you.
Here is the plunker
<table>
<tr>
<th>STOCK</th>
<th>PRICE</th>
<th>SHARES</th>
<th>WEIGHT</th>
</tr>
<tr ng-repeat="portfolio in portfolios">
<td ng-model="portfolio.stockfromdata"></td>
<td ng-model="portfolio.pricefromdata"></td>
<td>num</td>
<td ng-model="portfolio.weightfromprice"></td>
</tr>
</table>
Script
$scope.portfolios = [];
$scope.addStock = function() {
$scope.portfolios.push([{
"key": $scope.portfolio.stockfromdata,
"value": $scope.portfolio.pricefromdata
// "weightfromprice": $scope.weightfromprice
}]);
};

$scope.portfolio. And$scope.portfolios.push([{ "key": $scope.portfolio.stockfromdata, "value": $scope.portfolio.pricefromdata // "weightfromprice": $scope.weightfromprice }]);this is not correct as you are uisng data in ui with key names it ahould be like$scope.portfolios.push([{ "stockfromdata": $scope.portfolio.stockfromdata, "pricefromdata": $scope.portfolio.pricefromdata // "weightfromprice": $scope.weightfromprice }]);{}so that you won't get error as above.