When I use ng-options to define options in a select element, everything works fine with just the controller name within the ng-controller directive. However, adding "as options" to the ng-controller causes it to stop working (no options are displayed).
Example that doesn't work:
<div ng-controller="optionsCtrl as options">
<select ng-model="options.oxygenSource" ng-options="item.name for item in options.oxygenSources"></select><br />
</div>
Example that works:
<div ng-controller="optionsCtrl">
<select ng-model="oxygenSource" ng-options="item.name for item in oxygenSources"></select>
</div>
If you need more context, here's my controller code:
.controller('optionsCtrl', ['$scope', 'adminServ', function ($scope, adminServ) {
// User selections
$scope.oxygenSource = null;
$scope.oxygenSources = adminServ.getOxygenSources();
}])
Any ideas on why this might be happening? Thanks, Jason