I would like to return back from my API a list of all the products that were updated by the API. The API is called by some AngularJS code that uses a promise that returns data. In what format should I build a string of Products on the server-side that can be interpreted by Angular on the client-side?
C#
string results = "WidgetA - $12, WidgetB - $22 - ....":
return Request.CreateResponse<string>(HttpStatusCode.OK, results);
HTML
<div ng-repeat="model in data ">
{{model.ProductName + ' ' + model.ProductPrice + ' imported' }}
</div>
Angular
.then(function (data) {
// promise fulfilled
if (data === '') {
alert("No Data Returned");
} else {
// Data is returned
// How to get it in model that can be iterated over
}
}
Ideally I would like to end up with a list a Products and Prices that were updated.