php - JSONP & Angular Adding Extra Empty data -


everything working fine i'm getting 5 lines of empty data when there no other data:

example:

 sat, apr 25 2015 madison square garden, new york, new york, usa wladimir klitschko 63 vs bryant jennings 19 vs vs vs vs vs sat, may 09 2015 minute maid park, houston, texas, usa james kirkland 32 vs saul alvarez 44 vs vs vs vs vs 

my js:

function widgetctrl($scope, $http) { $scope.items = []; $http.jsonp("http:/domain.com/schedule?callback=json_callback").success(function(data)  {     $scope.items = data; }).error(function(data, status, headers, config) {     $scope.status = status; }); } 

index.html

<div id="widget-content" ng-controller="widgetctrl">       <div ng-repeat="item in items"> {{item.searchdate}} {{item.event_place}} <div class="widget-list"> <div ng-repeat="name in item"> {{name.boxer1_name}} {{name.boxer1_w}} vs {{name.boxer2_name}}                {{name.boxer2_w}} </div>          </div> </div> </div> 

json:

[     {       "event_id":"1821",     "searchdate":"sat, apr 25 2015",     "event_place":"madison square garden, new york, new york, usa",     "networks":"tv: hbo boxing",     "time":"time: 9pm et",     "0":{         "match_id":"5068",       "match_name":"heavyweight",       "mainevent":"main",       "body":"",       "boxer1_id":"7",       "boxer1_name":"wladimir klitschko",       "boxer1_w":"63",       "boxer1_l":"3",       "boxer1_d":"0",       "boxer1_ko":"53",       "boxer2_id":"2780",       "boxer2_name":"bryant jennings",       "boxer2_w":"19",       "boxer2_l":"0",       "boxer2_d":"0",       "boxer2_ko":"10"     }   },   {       "event_id":"1853",     "searchdate":"sat, may 09 2015",     "event_place":"minute maid park, houston, texas, usa",     "networks":"tv: hbo",     "time":"time: 9pm et",     "0":{         "match_id":"5127",       "match_name":"super welterweight",       "mainevent":"main",       "body":"",       "boxer1_id":"233",       "boxer1_name":"james kirkland",       "boxer1_w":"32",       "boxer1_l":"1",       "boxer1_d":"0",       "boxer1_ko":"28",       "boxer2_id":"1336",       "boxer2_name":"saul alvarez",       "boxer2_w":"44",       "boxer2_l":"1",       "boxer2_d":"1",       "boxer2_ko":"31"     }   } ] 

i believe problem "name in item" in second ng-repeat. going through 6 pieces of data (event_id, searchdate, etc.) , 1 find boxer data in item called "0". based on data should use

      <ng-repeat="name in item.0"> 

because boxer data contained in item.o not in item.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -