Shivam Vahia Shivam Vahia - 1 year ago 85
Javascript Question

AngularJS GET Request with Parameter

I'm working on a project wherein Analytics from a WordPress Site need to be requested in an App via AngularJS GET Function. I want to filter out data from the JSON API. Can someone please help me with the Code?


I need to display the "label" , "data" as Monday, Tuesday, Wednesday, Thursday...

Here's what I've done until now:

<html ng-app="countryApp">

<meta charset="utf-8">
<title>Angular.js JSON Fetching Example</title>
<link rel="stylesheet" href="">

<script src=""></script>


var countryApp = angular.module('countryApp', []);

countryApp.controller('CountryCtrl', function ($scope, $http){

$http.get('').success(function(data) {

$scope.countries = data;





Given the dates are provided in the labels array, you could transform the data arrays with something like this

$http.get(url).then(function(response) {
    var visitDates = {
        return new Date(dateString);

    $scope.visits =;

    angular.forEach($scope.visits, function(dataSet) { =, i) {
            return {
                date: visitDates[i],
                count: count

Then, each data entry will have a date that you can pass through Angular's date filter.

<div ng-repeat="dataSet in visits">
        <li ng-repeat="datum in">{{ | date: 'EEEE'}} is {{datum.count | number}}</li>

If you're not comfortable with using strings like "May 28, 2016" in the Date constructor, you could always use something like moment.js to parse them.

Plunker demo ~