I am relatively new to working with AngularJS and currently I am developing a web application in Django where I am utilizing AngularJS for the frontend. The issue I am facing is that the dropdown list, populated with objects from a scope, always starts with a blank element. This causes problems because if the user does not select anything, the POST request may fail to work. I am looking for a way to have a preselected value or something similar. Here is a snippet of my code:
Select tag:
<select id="sel" class="input-block-level" ng-model="list_category">
<option ng-repeat="obj in list_categories.data" value="{{obj.id}}">{{obj.name}}</option>
<option value="Other">Other</option>
</select>
$scope.list_categories:
var listcategoryPromise = ListCategory.get();
listcategoryPromise.then(function(response) {
$scope.list_categories = {
meta : response.data.meta,
data : response.data.objects
};
});