Сторона сервера:
public LowController : ApiController
{
[HttpGet]
public IActionResult<IEnumerable<Apt>> ShortLow()
{
List<Apt> emplist = new List<Apt>();
using (DBModel db = new DBModel())
{
var results = db.Fun_SL().ToList();
foreach (var result in results)
{
var apts = new Apt()
{
AptID = result.AptID,
EyrieID= result.EyrieID,
symbol = result.symbol,
isin = result.isin,
};
emplist.Add(apts);
}
return emplist;
}
}
Клиент: Index.html
<html>
<body ng-app="shortLowApp" ng-controller="shortLowController">
<table>
<tr>
<th>Symbol</th>
<th>isin</th>
</tr>
<tr ng-repeat="data in symbols">
<td>{{ data.symbol }}</td>
<td>{{ data.isin }}</td>
</tr>
</table>
<script src="Scripts/lib/angular.js"></script>
<script src="Scripts/app.js"></script>
</body>
</html>
ClientSide: app.js
// <reference path="lib/angular.js" />
var shortLowApp = angular.module('shortLowApp', []);
var shortLowController = shortLowApp.controller('shortLowController', function
($scope, $http) {
$scope.symbols = [
{
"symbol": "1",
"isin": "Super Cateogry"
},
{
"symbol": "2",
"isin": "Top Cateogry"
},
{
"symbol": "3",
"isin": "Sample Cateogry"
},
{
"symbol": "4",
"isin": "Product Cateogry"
}
];
// for producing above array, return a JSON array from your Server side Angular Controller method by using http.Get call.
//$http.get("https://localhost:44370/api/low/ShortLow").then(function (symbolData) {
// $scope.symbols = symbolData.symbols;
//});
So, un comment above HTTP get call and comment the hardcoded array. Make sure, you have some controller at Web api side, which produces the data.
});
Дайте мне знать, если вы обнаружите какие-либо трудности с получением результата, который вы хотели.
Приведенный выше код производит следующий вывод на моей стороне.