0
I am using Angularjs to fill out the data of a form within a modal.
have a function editarSolicitacao(solicitacao)
which runs from the button click event. When the modal opens the field is selected but the selection quickly disappears and I noticed that the following tag is created in HTML
<option value="? number:7 ?"></option>
<select ng-model="solicitacao.setor_id" class="form-control" required>
<option value="">(Selecione)</option>
<option ng-value="setor.id" ng-repeat="setor in setores" ng-bind="setor.id" ng-selected="setor.id == solicitacao.setor_id"></option>
</select>
Someone’s been through something like this and can tell me how to proceed?
my function which opens the modal and fills the form:
$scope.editarSolicitacao = function(solicitacao)
{
unidadeMedidas();
setores();
$scope.solicitacao = solicitacao;
$scope.produtos = $scope.solicitacao.produtos_adicionados;
$scope.showProdutos = true;
modal();
}
unidadeMedidas = function()
{
$http({
method: 'GET',
url: '/unidade-medida/consultar'
}).then(function(response){
$scope.unidades = response.data;
},function(responseError){
wgmAlert(responseError.statusText);
});
}
setores = function()
{
$http({
method: 'GET',
url: '/setores'
}).then(function(response){
$scope.setores = response.data;
},function(responseError){
wgmAlert(responseError.statusText);
});
}
modal = function()
{
$scope.modal = Modal({
animation: 'slideDown',
draggable: true,
width: $(window).outerWidth() -300,
title: 'Solicitação',
height: $(window).outerHeight() - 100,
template: $('#template-form-solicitacao').html(),
clickOut: false
},$scope);
$scope.modal.show();
}
I edited the question. When I open the modal for the first time it is selected. If I close and open again it does not keep selected.
– Miguel Batista
I managed to solve the problem.
– Miguel Batista
@Miguelbatista I am with this same problem can inform me how it solved?
– Ricardo Chomicz