javascript - Using ng-repeat on a position of $scope -


i have array like:

$scope.items = []; $scope.items[0] = {val1: 1, val2: 2} 

i'm trying use ng-repeat like:

<div ng-repeat = "item in items[0]"> {{item.val1}} </div> 

which right way use this? :d !

items[0] not array object need use (key, value) in expression notation (see docs) iterate on object properties:

<div ng-repeat="(key, value) in items[0]">{{key}} {{value}}</div> 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -