javascript - how to display individual values within JSON array angualrjs -
i have json file named (for now) 0.json. want display arrays within json object individual values (maybe display them badges).
here json:
[ { "id": "chinwe chukuwogu roy wordpress biography website", "name": "chinwe roy biography website", "practices": ["ux", "html wireframing", "front-end development", "custom wordpress theming"], "technology": ["wordpress", "html", "css", "jquery", "tweenmax", "inkscape", "photoshop"], "time": "6 weeks", "description": "a biography website celebrating work of world reknowned artist, chinwe chukwogu roy", "images": "../assets/img/ux.svg", "header": "../assets/img/wordpress-project.svg", "behance": "https://www.behance.net/gallery/33173663/ui-design-a-website-biography-project" } ]
i call json within controller:
$http.get('app/resources/v1/projects/' + $routeparams.id + '.json').success(function (details) { $scope.details = details; });
html:
<div class="row" ng-controller="projectctrl"> <ng-header class="header-directive">{{ detail.header }}</ng-header> <div class="container"> <div class="row"> <div class="col-md-12 work-parent" ng-repeat="detail in details"> <div class="work-child"> <h1>{{ detail.id }}</h1> <br> <p>{{ detail.description }}</p> <small><strong>technologies:</strong> {{ detail.technology }}</small> <small><strong>design practice:</strong> {{ detail.practices }}</small> <small><strong>turnaround:</strong> {{ detail.time }}</small> <ul class="social-icons"> <li class="behance"><a href="{{ detail.behance }}" target="_blank">behance</a></li> </ul> </div> </div> </div> </div> </div>
the issue having unable show e.g practices individual values. complete array in view when bind detail.practices ng-repeat.
how manage in controller?
just nest ng-repeat inside main one, along lines of:
<small ng-repeat="practice in detail.practices"><strong>design practice:</strong> {{ practice }}</small>
or else want them appear.
Comments
Post a Comment