My problem is loading information into a modal. Controller Parent:
App.controller('adminSolicitacoesCtrl', function($scope, $location,
$auth, solicitacaoAdminService, EmpresaService, $filter, $rootScope)
{
$scope.solicitacao_modal = [];
$scope.init(function(){
//LISTA AS SOLICITAÇÕES DA EMPRESA
var listaSolicitacao = function()
{
$scope.init(function(){});
solicitacaoAdminService.listarSolicitacoes(function(response)
{
$scope.solicitacoes = response;
},
function(err){
console.log(err);
swal("Não foi possível carregar as solicitações", "Tente novamente mais tarde", "error");
});
}
$scope.verSolicitacao = function(id)
{
solicitacaoAdminService.versolicitacao(id, function(response)
{
$('#verSolicitacao').modal();
$scope.solicitacao_modal = response;
$rootScope.$broadcast('verSolicitacao', $scope.solicitacao_modal)
}, function(err)
{
console.log(err);
swal("Não foi possível carregar as solicitações", "Tente novamente mais tarde", "error");
});
};
listaSolicitacao();
});
});
Child Controller:
App.controller('verSolicitacaoCtrl', function($scope, $location, $auth,
solicitacaoAdminService, EmpresaService, $filter, $rootScope,)
{
$scope.solicitacoes_recebe = []
$scope.init(function(){
$scope.$on('verSolicitacao', function(solicitacao_recebe) {
$scope.solicitacoes_recebe = $scope.solicitacao_modal;
$scope.solicitacoes_recebe;
});
});
});
html:
<div class="modal fade modal-padrao" tabindex="-1" role="dialog" id="verSolicitacao" style="z-index: 20000;" ng-controller="verSolicitacaoCtrl as Slct">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Solicitação</h4>
</div>
<div class="modal-body">
<div class="row" style="margin-top:-30px">
<div class="col-md-12">
<h3>O cliente {{Slct.solicitacao_modal.nome_empresa}} solicitou o seguinte: <b style="color:red">{{slct.solicitacoes.tipo_solicitacao}}</b></h3>
<hr>
</div>
...
All data is being successfully passed by loading the content by base of the selected id (not applicable), the $ broadcast to $ on is also working and the child scope receives the array with the information but I can not display them within the modal. I have tried to use a controller only and several ways to call the variable that seemed plausible, but although the information for the scope is being passed inside the controller see RequestCtrl, I can not display anything in the modal.