I need to create a table with the following object:
this.customer =
[{
cid:"1",
productid:"1",
src:"walmart",
total:"1"
},
{
cid:"1",
productid:"1",
src:"target",
total:"2"
},
{
cid:"1",
productid:"1",
src:"tjmax",
total:"2"
},
{
cid:"1",
productid:"2",
src:"walmart",
total:"1"
},
{
cid:"1",
productid:"2",
src:"target",
total:"4"
},
{
cid:"1",
productid:"2",
src:"tjmax",
total:"0"
},
{
cid:"2",
productid:"1",
src:"walmart",
total:"0"
},
{
cid:"2",
productid:"1",
src:"target",
total:"3"
},
{
cid:"2",
productid:"1",
src:"tjmax",
total:"6"
},
{
cid:"2",
productid:"2",
src:"walmart",
total:"4"
},
{
cid:"2",
productid:"2",
src:"target",
total:"6"
},
{
cid:"2",
productid:"2",
src:"tjmax",
total:"8"
}];
I need to build a table using AngulaJS and Bootstrap; I have no problems with bootstrap. I am trying to use ng-repeat, but I am not getting the result that I want. This is how I need my table.
+-------------------------------------------+
| cid | productId1 | productId2 |
+-----+------------------+------------------+
| 1 | wal:1,tar:2,tj:2 | wal:1,tar:4,tj:0 |
+-------------------------------------------+
| 2 | wal:0,tar:3,tj:6 | wal:4,tar:6,tj:8 |
+-------------------------------------------+
Can I achieve this with ng-repeat? Any ideas using other directives?
Update 1 SEP 2016
js json. -. , , html. -, . . , 0. Network Responses, json- , -. ? $http.
(function () {
'use strict';
var app = angular.module('myApp', ['angular.filter']);
app.controller('CustomerTable', function ($scope, $http) {
$http({
method: 'GET',
url: '../_includes/web_service_person.php'
}).then(function successCallback(data) {
$scope.customer = data;
}, function errorCallback(data) {
console.log(":(");
});
});
})();
<pre>{{customer | json}}<?pre>, , json-. , , undefined. ?