User-1846805900 posted
Hi
i need to use js code in about 10 pages - but each page will have get url not as other as example:
page 1: will use get url: /api/Ready
page 2: will use get url: /api/NotReady
page 3: will use get url: /api/Done
page 4: will use get url: /api/waiting list
all will use that same js code:
var app = angular.module('jqanim', []);
app.controller('InvoiceController', [
'$scope', '$http', function ($scope, $http) {
$http.get("/api/NoReady") // this is url needed to pass as parameter ?
.success(function (data) {
var dataByMonth = {};
data.forEach(itemToMonth);
$scope.customersByMonth = dataByMonth;
function itemToMonth(item) {
item.MirageDate = new Date(item.MirageDate)
var month = item.MirageDate.getMonth();
var year = item.MirageDate.getFullYear();
dataByMonth[year + '-' + month] = dataByMonth[year + '-' + month] || [];
dataByMonth[year + '-' + month].push(item);
}
});
}
]);
so please can i get help about that with sample example to learn how can i do it ?
Thanks a lot ...