i am populating a collection called CommandGroup like this
function getCommandGroups() {
$scope.commandGroups = commandGroupResource.query();
return $scope.commandGroups.$promise.then(function (response) {
$scope.commandGroups = response;
});
}
my html looks like this.
<select ng-model="vm.Job.CommandGroup" name="ddlCommandGroup" bootstrap-dropdown>
<option value="">Select Something</option>
<option ng-repeat="cmdGroup in commandGroups" value="{{cmdGroup.Id}}">{{cmdGroup.Name}}</option>
</select>
for some reason drop down remains empty. The function getCommandGroups() calls back end and populates commandGroups with array of objects each of which has Id and Name.
Please help.
UPDATE
i figured out something is wrong with the directive bootstrap-dropdown which is required as it is Bootstrap-select
angular
.module('app').directive('bootstrapDropdown', ['$timeout',
function ($timeout) {
return {
restrict: 'A',
require: '?ngModel',
link: function (scope, element, attrs, ngModel) {
$timeout(function () {
element.selectpicker();
});
}
};
}
]);

responsedoes have that value?{{commandGroups}}seems like you are facing scope related issue..you placed this div insideng-iforng-repeatgetCommandGroups()- only the first line is needed. you may delete the entire return statement.