Meteor.publishComposite bug with angular-meteor
Hello, thanks for read.
I need a help with this question:
When my publish
bring me more than one document, this bring me the data that I need, and the childrens works!. But when my publish
only has a element, and the children don’t work, why?
Next my code:
FILE JS IN CLIENT
import...
class VerCandidatos {
constructor($scope, $reactive, $uibModal, $stateParams) {
'ngInject';
$reactive(this).attach($scope);
this.vacanteId = $stateParams.vacanteId;
this.subscribe('vacantes.candidatos', ()=> [{vacanteId: this.vacanteId}]);
this.titulo = 'vista de vacantes';
this.$uibModal = $uibModal;
this.helpers({
postulados (){
return Postulaciones.find();
}
});
}
verDatosGenerales(id) {
return Candidatos.findOne({_id: id});
}
verPerfil(id) {
return Perfiles.findOne({candidatoId: id});
}
}
FILE HTML
<div class="list-group">
<a href ng-click="verCandidatos.contactar(postulado._id)" class="list-group-item" ng-repeat="postulado in verCandidatos.postulados">
<!-- (FOTO) Y (DATOS | AVIÓN) -->
{{postulado}}
<div class="row">
<!-- DATOS Y AVIÓN-->
<div class="col-xs-12 col-sm-10" ng-init="datosGrls = verCandidatos.verDatosGenerales(postulado.candidatoId)">
<h4 class="list-group-item-heading">{{datosGrls.nombre}} {{datosGrls.apellidos}}</h4>
<div class="row">
<!-- DATOS -->
<div class="col-xs-12 col-sm-10" ng-init="perfilLaboral = verCandidatos.verPerfil(postulado.candidatoId)">
<p class="list-group-item-text">
<strong>Perfil</strong>: {{datosGrls.sexo}} | {{perfilLaboral.puesto}}
| {{perfilLaboral.escolaridad}} | Talla {{perfilLaboral.talla}}|
Estatura {{perfilLaboral.estatura}}
</p>
<p>
<strong>Experiencia</strong>:
<ul class="list-inline">
<li ng-repeat="experiencia in perfilLaboral.experiencias.listado">{{experiencia}} |</li>
</ul>
</p>
<strong>Habilidades</strong>:
<p class="list-group-item-text">
Buena presentación | Facilidad de Palabra | Gusto por
</p>
</div>
<!-- AVIÓN -->
<div class="col-xs-12 col-sm-2">
<i class="fa fa-paper-plane fa-3x" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
</a>
</div>
FILE in SERVER
Meteor.publishComposite('vacantes.candidatos', function (vacanteId) {
if (!this.userId) return;
const selector = {$and: [{estado: 1}, vacanteId]};
return {
find: function () {
return Postulaciones.find(selector);
},
children: [
{
find: function (postulacion) {
return Candidatos.find({_id: postulacion.candidatoId}, {
fields:{
nombre: 1,
apellidos: 1,
sexo: 1,
}
});
}
},
{
find: function (postulacion) {
return Perfiles.find({candidatoId: postulacion.candidatoId});
}
}
]
}
});
Any ideas?
Thanks for your time