I have problem accessing an array inside an array of objects in AngularJS.
HTML:
<li ng-repeat="ai in main.a2">
<div np-repeat="bi in ai.b">
<span ng-bind="bi"></span>b2
</div>
</li>
javascript:
var app = angular.module('app', []);
app.controller('MainCtrl', ['$scope', function($scope) {
self.a2 = [
{b: ['foo']},
{b: ['bar', 'baz']},
{b: ['boo']}
];
}]);
Expected output:
foob2
foobazb2
boob2
Real output:
b2
b2
b2
And here is the (non-working) example.
I have checked similar posts, but most of them are just mistakes, and so could be mine. But I have checked with errors so I am thinking that I have fallen into some pitfall.
np-repeat
, should beng-repeat