So, I have a user search very similar to facebook.
<form class="navbar-form navbar-left" role="search" ng-controller="pesquisas">
<div class="form-group">
<input type="text" ng-keyup="search()" ng-keydown="search()" ng-model = "pesquisa.nome_usuario" class="form-control pesquisar_input" placeholder="Pesquisar">
</div>
<!-- <button type="submit" class="btn btn-default">Pesquisar</button> -->
<div class = "resultado_pesquisa" ng-show="resultado>0">
<ul>
<li class = "linha_usuario_pesquisa"ng-repeat = "usuario in usuarios " data-refresh-list data-toggle="modal" href='#avaliacao' ng-click="dados_usuario(usuario)" ng-controller="avaliacao" >
<div class = "imagem_perfil_masculino pull-left" ng-show="usuario.sexo_usuario==1">
<span class="glyphicon glyphicon glyphicon-user usuario_masculino" ></span>
</div>
<div class = "imagem_perfil_feminino pull-left" ng-show="usuario.sexo_usuario==0">
<span class="glyphicon glyphicon glyphicon-user usuario_masculino" ></span>
</div>
<span class = "nome_linha_usuario pull-left" >{{usuario.nome_usuario}}</span>
</li>
</ul>
</div>
</form>
The controller that performs the search is this.
$scope.search = function(){
if($scope.pesquisa.nome_usuario.length >0){
$http.post('usuarios/consult_user',$scope.pesquisa)
.success(function(data){
$scope.resultado = 1;
$scope.usuarios = data;
});
}
else{
$scope.resultado = 0;
$scope.usuarios = 0;
}
}
When you start my list I can click on it, and send the user data through a ng-click, my controller that receives this information is as follows.
app.controller('avaliacao', function ($scope, $http) {
$scope.dados = {};
$scope.dados_usuario = function (usuario) {
$scope.dados = usuario;
});
});
At the same time that this function is requested, the following modal is opened, where the idea is to enter all the user information that has been retrieved.
<div class="modal fade " id="avaliacao" data-backdrop="static" ng-controller="avaliacao">
<div class="modal-dialog full-screen">
<div class="modal-content" >
<div class="modal-body">
<div class="navbar navbar-fixed-top nav-interna">
<div class = "imagem_perfil_masculino_interno pull-left" >
<span class="glyphicon glyphicon glyphicon-user usuario_masculino" ></span>
</div>
<span class="pull-left nome_aluno_interno" ><h4 >{{dados.nome_usuario}}</h4></span>
<button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
</div>
</div>
</div>