In my quest to enhance my table with JSON data upon clicking the +
icon, I am faced with two sections: Pick Stocks where stock names and prices (retrieved from data.json) need to be added to the table found in the Manage Portfolio section.
First Section https://i.stack.imgur.com/P839d.jpg
Second Section
https://i.stack.imgur.com/BBmbn.jpg
My goal is to populate the respective stock name such as ADFI, ALAN, etc., alongside their prices into the corresponding columns of the table in the second section whenever the relevant +
icon is clicked.
Although I have made attempts at this, I am unsure about the next steps.
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
}]);
};