Hello, thanks for read
Comportamientos:
when the result verCandidatos.postulados
only have one value (like rectangle in img) never print the first time, I need refresh or click again and print values why?
html client
**my-app/imports/ui/components/vacantes/verCandidatos/**verCandidatos.html
<div ng-repeat="postulado in verCandidatos.postulados">
{{postulado.candidato().nombre}}
{{postulado.candidato().apellidos}}
{{postulado.candidato().sexo}}
</div>
Next the images:
IMG 1
IMG 2
js in client
**my-app/imports/ui\components/vacantes/verCandidatos/**verCandidatos.js
imports ...
class VerCandidatos {
constructor($scope, $reactive, $stateParams) {
'ngInject';
$reactive(this).attach($scope);
this.vacanteId = $stateParams.vacanteId;
this.subscribe('vacantes.candidatosOseleccionados', ()=>
[
{vacanteId: this.vacanteId},
{estado: 1}
]
);
this.helpers({
postulados (){
return Postulaciones.find();
}
});
}
}
collection.js
**my-app/imports/api/postulaciones/**collection.js
imports...
export const Postulaciones = new Mongo.Collection('postulaciones');
Postulaciones.deny({...});
Postulaciones.helpers({
candidato(){
return Candidatos.findOne({_id: this.candidatoId});
}
});
publish.js:
**my-app/imports/api/vacantes/server/**publish.js
imports...
if (Meteor.isServer) {
Meteor.publishComposite('vacantes.candidatosOseleccionados', function (vacanteId, estado) {
const selector = {$and: [estado, 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,
}
});
}
}
]
};
});
}
Any ideas?
- Thanks,