48395

AngularJS: nested ng-repeat (array in object) only works if there is one item in array, not when mul

Okay, I have a weird issue. I have an array of objects. Each object contains another array (of strings). I loop over the array of objects using ng-repeat. Within the repeated code I ng-repeat over the array of strings. For some reason, this nested ng-repeat only works when the array of strings contains but one (1) item. When there are more items, it simply doesn't work.

<strong>Code</strong>

Result of <pre>{{ answer.value | json }}</pre>

[ "Apothekerskast", "Apothekerskast", "Koelkast ombouw" ]

The view (in a gist because posting here causes issues with markdown): https://gist.github.com/fabdrol/898e4ac9760fc358ce81

The data (in JSON), for easy reading: https://gist.github.com/fabdrol/089467fa09dad6e89e81

Answer1:

It doesn't like duplicates, use track by $index:

ng-repeat="val in vals track by $index"

JSFiddle: http://jsfiddle.net/nedq13q2/

Recommend

  • ListItem.Attributes.Add not working
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • Play WS (2.2.1): post/put large request
  • Different response to non-authenticated users and AJAX calls
  • Can Jackson SerializationFeature be overridden per field or class?
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Javascript Callbacks with Object constructor
  • ILMerge & Keep Assembly Name
  • How can I use Kendo UI with Razor?
  • Large data - storage and query
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Jquery - Jquery Wysiwyg return html as a string
  • How to get next/previous record number?
  • Apache 2.4 - remove | delete | uninstall
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • WOWZA + RTMP + HTML5 Playback?
  • R: gsub and capture
  • php design question - will a Helper help here?
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Arrays break string types in Julia
  • Comma separated Values
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • WPF Applying a trigger on binding failure
  • Proper way to use connect-multiparty with express.js?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Trying to get generic when generic is not available
  • Java static initializers and reflection
  • embed rChart in Markdown
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Is it possible to post an object from jquery to bottle.py?
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?
  • How do I use LINQ to get all the Items that have a particular SubItem?