angularjs - Show JSON data from URL w/ Parameter -
i'm having trouble displaying information rest api. each location_id (2-7) have own json data.
how can data display each individual location_id. below code:
controller:
countryapp.controller('viewlocation', function($scope, $http, $routeparams) { $scope.localeid = $routeparams.localeid; $http.get('http://localhost/slimtest2/location/' + $scope.localeid).success(function(data) { $scope.location = data; }); );
view individual item
<div ng-controller="viewlocation"> stuff <div ng-model="location in location.location"> {{ location.location_id }} </div> </div
the json data http://localhost/slimtest2/location/(location_id). have location_ids 2-7.
{ "location" :[{"location_id":"2","location_reference":"657821349","location_title":"guam premier outlet,? ???? ???","location_category":"shop,??","location_subcategory":"shopping mall,???","location_latitude":"13.489714","location_longitude":"144.781906","location_image":"gpo1.jpg","location_description":"description test gpo,gpo | ? ?? ?? ???","location_address":"tamuning, 96913\r\nguam | ?? ? , 96913\r\n?","location_village":"tamuning","location_pricerange":"3","location_price":"100"}]}
ng-model
used input types input fields, textarea , select not div. looking ng-repeat
iterate json object
<div ng-repeat="loc in location.location"> {{ loc['location_id'] }} </div>
Comments
Post a Comment