Created
September 2, 2015 20:49
-
-
Save tiagoeborsanyi/c9bae4d97670b689a03e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var id = 0; | |
$scope.adicionalinha = function(){ | |
$http.get('/inicio/'+$routeParams.id).success( | |
function(memorando){ | |
console.log("memorando tamanho "+memorando.tabela.length); | |
id += memorando.tabela.length; | |
}, | |
function(erro){ | |
console.log('não foi possível obter o tamanho do array') | |
}); | |
$("#btn-adiciona").on('click', function(event){ | |
var situacoes = []; | |
//API que vem os dados | |
$http.get('/configuracao/situacao').success(function(situacaolista){ | |
situacoes = situacaolista; | |
event.preventDefault(); | |
var tdConteudo = '<td><input type="text" id="t'+id+'" placeholder="Tombo" required ng-model="memorando.tabela.tombo"></td>'+ | |
'<td><input type="text" id="d'+id+'" placeholder="Descrição" required ng-model="memorando.tabela.descricao"></td>'+ | |
'<td><input type="text" id="l'+id+'" placeholder="Local" required ng-model="memorando.tabela.local"></td>'+ | |
'<td><select id="s'+id+'" ng-model="memorando.tabela.situacao" ng-options="situ.nome for situ in '+teste+'">'+ | |
'<option value="">--Escolha uma situação--</option>'+ | |
'</select></td>'+ | |
'<td><a id="'+id+'" class="remove-item" href=""><i class="icon-remove"></i></a></td>'; | |
++id; | |
$('<tr>').append(tdConteudo).appendTo('#tabela-body'); | |
}, | |
function(erro){ | |
console.log(erro); | |
console.log('não foi possível obter o equipamento'); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment