I have this situation where my ng-Repeat I can get working to a certain level but any deeper I can't find the array.
Here is my code and also a plunkr below:
<div ng-repeat="row in data">
<label ng-repeat="key in keys">
{{row[key]}}
<input name="optradio" type="radio"/>
</label>
This PLunker works ok but I want to go down to the Options layer to display just Option1 and Option2.
options
is an array thus you just have to iterate over it
var app = angular.module('app', ['ui.bootstrap']);
app.controller('Ctrl', ['$scope',
function($scope) {
$scope.data = [{
"property": "http://api.mydomain.co.uk/",
"type": "Selection",
"options": [{
"text": "Option 01",
"value": "http://api.mydomain.co.uk/O",
"type": "SelectionOption"
}, {
"text": "Option 02",
"value": "http://api.mydomain.co.uk/L",
"type": "SelectionOption"
}]
}];
$scope.keys = Object.keys($scope.data[0]);
}
]);
<!DOCTYPE html>
<html>
<head>
<link data-require="bootstrap-css@3.x" data-semver="3.2.0" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<script data-require="angular.js@*" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
<script data-require="ui-bootstrap@*" data-semver="0.10.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="app" ng-controller="Ctrl">
<div ng-repeat="row in data">
<label ng-repeat="opt in row.options">
{{opt.text}}
<input name="optradio" type="radio" />
</label>
<br>
</div>
</body>
</html>