0

Partial Code

.controller('HomeCtrl', ['$scope', '$stateParams', 'lastactivities',
  function($scope, $stateParams, lastactivities) {
    var mytoken = sessionStorage.getItem('token');

    lastactivities.send(mytoken).then(function(activities) {
      var activitytab = activities.data;
      $scope.datab = activities.data;
    });
  }
])
<ul ng-repeat="item in datab">
  <li ng-repeat="value in item.date track by $index">{{value}}</li>
</ul>

JSON

{
  "erreur": "",
  "data": [{
    "date": "2016-03-04",
    "activities": [{
      "type": "bank",
      "icon": {
        "type": "lock-3",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "MOT DE PASSE MODIFIÉ",
      "description": ""
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "1 400 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "925",
      "title": "FACTURE",
      "description": "nike - appli mobile"
    }, {
      "type": "client",
      "icon": {
        "type": "user-1",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": 925,
      "title": "NOUVEAU CLIENT",
      "description": "nike"
    }]
  }, {
    "date": "2016-03-03",
    "activities": [{
      "type": "bank",
      "icon": {
        "type": "lock-3",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "MOT DE PASSE MODIFIÉ",
      "description": ""
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "643,44 €",
        "color": "#ffffff",
        "backgroundColor": "#f84c74"
      },
      "action": "719",
      "title": "FACTURE EN RETARD",
      "description": "Justine - Facture 2"
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "400 €",
        "color": "#ffffff",
        "backgroundColor": "#f84c74"
      },
      "action": "719",
      "title": "FACTURE EN RETARD",
      "description": "Justine - Ma first facture"
    }]
  }, {
    "date": "2016-02-18",
    "activities": [{
      "type": "bank",
      "icon": {
        "type": "lock-3",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "MOT DE PASSE MODIFIÉ",
      "description": ""
    }]
  }, {
    "date": "2016-02-08",
    "activities": [{
      "type": "bank",
      "icon": {
        "type": "lock-3",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "MOT DE PASSE MODIFIÉ",
      "description": ""
    }]
  }, {
    "date": "2016-02-02",
    "activities": [{
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "0 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "724",
      "title": "FACTURE",
      "description": "Test client - F - 00005"
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "0 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "720",
      "title": "FACTURE",
      "description": "Abus - F - 00004"
    }]
  }, {
    "date": "2016-02-01",
    "activities": [{
      "type": "client",
      "icon": {
        "type": "user-1",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": 724,
      "title": "NOUVEAU CLIENT",
      "description": "Test client - Scooby"
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "1 500 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "720",
      "title": "FACTURE",
      "description": "Abus - Fact"
    }, {
      "type": "client",
      "icon": {
        "type": "user-1",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": 720,
      "title": "NOUVEAU CLIENT",
      "description": "Abus - Busbus"
    }, {
      "type": "document",
      "icon": {
        "type": "download-6",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "7 DOCUMENTS DÉPOSÉS",
      "description": "retrait-par-carte-Invalid date.jpg, Document-01-02-2016.jpg, Doss1, Doss2, Document-01-02-2016.jpg, -Invalid date.jpg, retrait-par-carte-01-02-2016.jpg"
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "643,44 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "719",
      "title": "FACTURE",
      "description": "Justine - Facture 2"
    }, {
      "type": "bank",
      "icon": {
        "type": "lock-3",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "MOT DE PASSE MODIFIÉ",
      "description": ""
    }, {
      "type": "client",
      "icon": {
        "type": "document-1",
        "color": "#000000"
      },
      "badge": {
        "text": "400 €",
        "color": "#ffffff",
        "backgroundColor": "#97d42e"
      },
      "action": "719",
      "title": "FACTURE",
      "description": "Justine - Ma first facture"
    }, {
      "type": "client",
      "icon": {
        "type": "user-1",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": 719,
      "title": "NOUVEAU CLIENT",
      "description": "Justine - Arma"
    }, {
      "type": "bank",
      "icon": {
        "type": "flag-1",
        "color": "#000000"
      },
      "badge": {
        "text": "",
        "color": "#000000",
        "backgroundColor": "transparent"
      },
      "action": null,
      "title": "BIENVENUE À BORD DE TIIME AE",
      "description": "C'est parti pour 30 jours offerts"
    }]
  }]
}

I'm new in AngularJS and trying to display only the date and the type but no luck yet.

Any help would be appreciated!

3
  • 1
    Try <ul ng-repeat="item in datab"> and then <li>{{item.date}}</li> Commented Mar 7, 2016 at 10:23
  • It works well thanks you so much :) Commented Mar 7, 2016 at 10:26
  • @user3130401, please post this as an answer so it can be selected as the correct answer. Commented Mar 7, 2016 at 10:27

2 Answers 2

1

You can try something like this:

<ul ng-repeat="item in datab">
  <li ng-repeat="value in item">
    {{value.date}}
  </li>
</ul>

JSFiddle.

Sign up to request clarification or add additional context in comments.

Comments

0

try this:

.controller('HomeCtrl', ['$scope','$stateParams','lastactivities',
 function($scope, $stateParams,lastactivities) {
  var mytoken = sessionStorage.getItem('token');
  lastactivities.send(mytoken).then(function(activities){

  var activitytab = activities.data;

   var data=[];
for (var i=0;activities.data.length>0,i++)
{
    for(var j=0;activities.data[i].activities.length>0;j++)
    {
        data.push({date: activities.data[i].date, Type: activities.data[i].activities[j].type})
    }
}

  $scope.datab = data;

  });
 }
])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.