I am consuming a Ws which returns an array, and I present it in a select, the data is displayed well but I want to know how I give a default value this is what I have done
<div class="form-group">
<label for="sel1">Categoría 1:</label>
<select class="form-control"
ng-init = "data.emp_cat_uno = categorias[0]" //no funciona
ng-options="c.nombre_cat as c.nombre_cat for c in categorias "
ng-model="data.emp_cat_uno"
ng-change = "setear_id_cat_1()">
</select>
</div>
js
$scope.hideLoader = FctLoader.show($scope.hideLoader);
ServCategorias.servicioCategorias().success(function(data, status){
$scope.categorias = data.data.categorias;
})
.error(function(data, status){
alert(status+' provinicias');
})
.finally(function() {
$scope.hideLoader = true;
});
service
.service('ServCategorias',['$http',function($http){
this.servicioCategorias = function(){
return $http.get('url');
};
}])
I want to know how I make the first value is by default I hope and there is a solution with everything I thank you