I use this function to read data from a web service
$scope.getProduitByCatID = function () {
$http.get("/getProduitByCategorieID?id=" + $scope.categorie.id).success(function (data) {
$scope.produits = data;
});
};
value in my model $scope.produits
:
{
"reference": 1,
"designation": "sony",
"prix": 5100,
"categorie": {
"id": 1,
"nom": "serveur"
}
}
I want to show this result with ng-repeat
<tr ng-repeat="p in produits">
<td>{{p.reference}}</td>
<td>{{p.designation}}</td>
<td>{{p.prix}}</td>
</tr>
but it doesnβt work. I want to extract exactly this information in my model:
{
"reference": 1,
"designation": "sony",
"prix": 5100
}
because I have two objects product(id,designation,prix)
and categorie(id,nom)
in ManytoOne association, how can I do it using angularJS?
source
share