Talk about the Blz gal?!
I'm new to AngularJs.
I'm developing a form but I can not do ng-model abstraction. Follow the code below for a better understanding.
< - JS - >
/* CONFIGURAÇÃO DO FORM */
$scope.cfgForm = {
item: {
field: ["nome", "idade", "funcao"],
headers: ["Nome", "Idade", "Função"],
icon: ["person", "date_range", "business_center"]
}
};
/* DADOS */
$scope.clientes = [
{nome: "Pablo Mendoça", idade: 25, funcao: "Estagiário"},
{nome: "Ricardo Leite", idade: 41, funcao: "Diretor"},
{nome: "Francisco Motta", idade: 35, funcao: "Gerente de Contas"}
];
/* FUNÇÕES */
/* ADICIONAR CLIENTE */
$scope.addCliente = function(cliente){
console.log(cliente);
};
<div>
<!--{{cfgForm.item.field[k]}}-->
<md-input-container md-no-float class="md-block" ng-repeat="(k,field) in cfgForm.item.field">
<label>{{cfgForm.item.headers[k]}}</label>
<md-icon><i class="material-icons" >{{cfgForm.item.icon[k]}}</i></md-icon>
<input ng-model="cliente.field" type="text">
<!--{{cliente.field}}-->
</md-input-container>
<!--Botões de ação do Card-->
{{cliente.field}}
<md-card-actions layout="row" layout-align="end center">
<md-button class="md-icon-button" ng-click="addCliente(cliente)">
<i class="material-icons" >add_box</i>
<md-tooltip md-direction="left">
Adicionar
</md-tooltip>
</md-button>
</md-card-actions>
</div>
</md-card-content>
Well, what happens is that when I put the add button on ng-repeat it abstracts the data and shows it on the console, however it can not repeat, ie the button should stay outside ng-repeat. As I am shown above.
In this code section for example:
{{client.field}}
When I post the comment on 1st {{client.field}} it binds right. However the 2nd {{client.field}} that is already outside ng-repeat does not. and what I need is just do this, so I can pass the data on the ng-click that is outside the ng-repeat.
I would like help!