vendredi 29 janvier 2016

How to add class in angular using ng-repeat for adding a review purposes?

enter image description here

This is what i have so far, my data(retrieved via get: method expecting json) and the html part will do the ng-repeat for review in reviews; adding class filled. But it just add's filled to all. Open to any suggestion's, like this directives as well.

$scope.data = [{
    "_id": "56aa6f601c5e0d520e4a54ca",
    "index": 0,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 5,
    "name": "Kelli Alexander",
    "comment": "Eu mollit officia enim cupidatat consequat. Elit ex reprehenderit sint veniam Lorem in ad non exercitation fugiat dolore esse ex. Exercitation occaecat ut dolore voluptate labore minim eiusmod ea quis. Consectetur deserunt id minim exercitation eu sit Lorem laboris. Nulla minim ea fugiat ex sit pariatur adipisicing incididunt officia nisi. Incididunt dolore consectetur sunt quis irure in. Labore ipsum deserunt dolor quis incididunt occaecat minim mollit mollit incididunt officia reprehenderit ut ipsum.\r\n",
    "registered": "2014-06-09T04:11:13 +05:00",
}, {
    "_id": "56aa6f602b63c7bef8e4ad4b",
    "index": 1,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 3,
    "name": "Hopper Buck",
    "comment": "Eiusmod aliquip pariatur consequat et eu laboris. Mollit mollit reprehenderit enim sint incididunt dolor aliqua Lorem commodo aute aliqua aliquip. Et pariatur exercitation culpa irure occaecat. Elit id laboris quis culpa quis aute dolor consequat excepteur officia enim ullamco enim elit. Sunt pariatur reprehenderit quis commodo velit enim exercitation mollit.\r\n",
    "registered": "2014-04-11T03:22:35 +05:00",
}, {
    "_id": "56aa6f60fe9bae6d177b7137",
    "index": 2,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 2,
    "name": "Vera Mcfadden",
    "comment": "Ipsum consectetur ipsum velit do nostrud officia excepteur. Laboris qui consectetur officia culpa est mollit ex. Ea qui proident ut aute consequat ea proident quis duis.\r\n",
    "registered": "2015-10-05T12:46:04 +05:00",
}, {
    "_id": "56aa6f60d60a0c80b87fa3ed",
    "index": 3,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 3,
    "name": "Howard Christensen",
    "comment": "Pariatur commodo dolore ipsum aute cupidatat ipsum adipisicing voluptate sit voluptate commodo. Sint cupidatat eu sunt Lorem ad. Enim ex irure sit tempor culpa. Culpa cillum commodo duis laborum pariatur do aliqua culpa commodo consectetur eiusmod. Sit esse aute ad cupidatat do et Lorem ut tempor cillum. Proident consequat reprehenderit nulla excepteur elit ea exercitation adipisicing. Excepteur ullamco tempor ipsum ipsum Lorem tempor fugiat amet Lorem.\r\n",
    "registered": "2015-09-04T10:09:25 +05:00",
}, {
    "_id": "56aa6f60ba2f88f333bba049",
    "index": 4,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 3,
    "name": "Burke Reilly",
    "comment": "Do ex culpa adipisicing commodo ut aute consectetur cillum est eiusmod ut minim excepteur. Reprehenderit ex incididunt occaecat commodo magna est commodo reprehenderit non ullamco. Lorem proident velit incididunt nostrud labore mollit laboris nostrud ut commodo fugiat. Sint aliqua laborum laboris mollit magna proident. Veniam anim ad in aute sunt reprehenderit ullamco nisi sunt velit consequat amet. Nisi ea amet in labore.\r\n",
    "registered": "2014-11-18T09:16:38 +06:00",
}, {
    "_id": "56aa6f6061f6d711988c5521",
    "index": 5,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 3,
    "name": "Robyn Douglas",
    "comment": "Proident cupidatat incididunt ut anim sit excepteur esse ad veniam reprehenderit. Nisi dolor labore occaecat irure reprehenderit deserunt aute amet. Magna veniam sint velit esse laboris officia est in ipsum tempor voluptate quis sunt. Proident eu duis elit aliqua non anim consectetur consequat ut do.\r\n",
    "registered": "2015-12-18T01:58:11 +06:00",
}, {
    "_id": "56aa6f6018d679470f9c656c",
    "index": 6,
    "picture": " http://ift.tt/23yGF9V",
    "rating": 4,
    "name": "Avery Merritt",
    "comment": "Adipisicing proident consequat do aliquip. Anim magna deserunt ut culpa. In exercitation tempor quis in nisi nisi et velit nulla ea. Anim consequat mollit incididunt velit labore culpa qui consectetur in. Aliqua reprehenderit nostrud officia aliquip officia id amet ut proident aliquip adipisicing. Sunt incididunt minim et minim.\r\n",
    "registered": "2015-12-18T01:58:11 +06:00",
}];

add max 5 circles :

 <i class="ion-ios-circle-filled" ng-class="{filled: review.rating}" ng- repeat="n in range(5) track by $index"></i>

Aucun commentaire:

Enregistrer un commentaire