For my latest question, I decided to utilize ng-init
. However, upon loading the page, I noticed that there is a blank default option. When I click and select another option, the blank option disappears. How can I remove this initial blank option?
Here is the code snippet:
<select ng-change="filtro(selected)" ng-init="selected = Catalogos[0]" ng-model="selected" ng-options="item.Nombre for item in Catalogos">
</select>
And here is the controller function:
function cargarCatalogo() {
apiService.get("../../api/Catalogos/", null,
function (res) {
console.log(res.data);
$scope.Catalogos = res.data;
},
errorCatalogo);
}