I can't get angular to display the contents of an array object.
Controller.js
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
var items = [
{ id: 1, name: 'first obj', type: { open: true, name: 'Global' } },
{ id: 2, name: 'second obj', type: { open: true, name: 'Loco-l' } },
{ id: 3, name: 'third obj', type: { open: true, name: 'Global' } }
];
console.log(items)
});
template.html
<div ng-app="myApp" ng-controller="myCtrl">
<select ng-model="eachItem" ng-options="item for item in myCtrl.items">
<option value="">My default value</option>
</select>
</div>
Here is the JSFiddle:
https://jsfiddle.net/reala/n5bg060t/4/
EDIT: I would like to display item.type.name
, so two select fields will display "Global" then I'll eventually filter the results to show only unique values.