1
I’m trying to make a table, where it shows the list of orders and the button for editing
Lita of request:
var lista = [
{id: 1, nome: 'Pedido 1', ano1: 100, ano2: 200},
{id: 2, nome: 'Pedido 2', ano1: 100, ano2: 200},
{id: 3, nome: 'Pedido 3', ano1: 100, ano2: 200},
{id: 4, nome: 'Pedido 4', ano1: 100, ano2: 200},
{id: 5, nome: 'Pedido 5', ano1: 100, ano2: 200}
];
When you click on the Edit button, the inputs appear with the same module of the values shown in the table, which is initially hidden, to make changes
How can I do this function to show and hide inputs?
I thought I’d add some property editando
for request, however as this property is not any data of the request, I wondered if you have any way to accomplish this, without adding property in modal
<table class="table">
<tr>
<td>
<input type="checkbox" ng-click="selecionarTudo($event, lista)">
</td>
<td>Nome</td>
<td>Ano 1</td>
<td>Ano 2</td>
<td>Ação</td>
</tr>
<tr ng-repeat="pedido in selecionado" ng-click="tableCheck($event, pep)">
<td>
<input type="checkbox" ng-model="pedido.selected">
</td>
<td>{{pedido.nome}}</td>
<td>
{{pedido.ano1 | currency | real}}
<input type="text" ng-model="pedido.ano1">
</td>
<td>
{{pedido.ano2 | currency | real}}
<input type="text" ng-model="pedido.ano2">
</td>
<td>
<button class="btn">Editar</button>
</td>
</tr>
</table>
When you say "without creating variable" you mean you don’t want to add a new one property to the application or who really does not want to declare anything else in the scope?
– André Ribeiro
that’s right, but I just got it, I’ll update it already, posting result
– Lai32290
@Lai32290, you can post the answer and mark as accepted. Hence your question leaves the unanswered line and you still gain reputation ;)
– Caputo