Angularjs Display single element from json -
i have json file contains different prices service, depending on day of week (in weekend it's more expensive) use angular show these prices using lines this:
<div ng-repeat="arr in arrangementen | filter:'_1'" >mon-fri: € {{arr.prijs_ma_vr | number :2 }} </div> <div ng-repeat="arr in arrangementen | filter:'_1'" >sat: € {{arr.prijs_za | number :2 }} </div>
json:
{ "id": "_1", "arrangement": "vriendinnendag", "prijs_ma_vr": 99.95, "prijs_za": 103.95, "prijs_zo": 104.95, }, { "id": "_2", "arrangement": "vipdag", "prijs_ma_vr": 199.95, "prijs_za": 205.95, "prijs_zo": 209.95, }
i wonder if there more smart , easier way display these prices or other elements json. want display 1 element (i.e. 1 price)
(example in site: wellness example
i rework json , way:
{ "id": "_1", "arrangement": "vriendinnendag", "prijs":[ 99.95, 103.95, 104.95 ], “day”:['mon-fri','sat','sun'] }, { "id": "_2", "arrangement": "vipdag", "prijs":[ 199.95, 203.95, 204.95 ], “day”:['mon-fri','sat','sun'] } <div ng-repeat="arr in arrangementen | filter:'_1'" > day[0] € {{arr.prijs[0] | number :2 }}<br> day[1] € {{arr.prijs[1] | number :2 }}<br> day[2] € {{arr.prijs[2] | number :2 }} </div>
Comments
Post a Comment