J'utilise now.js et Mongoose dans un projet de nœud et j'ai du mal à accéder à l'objet this.now à l'intérieur d'une fonction mongoose. Par exemple.La variable JavaScript (node.js) n'est pas accessible dans l'appel de fonction interne. now.js
everyone.now.joinDoc = function (project_id){
this.now.talk(); //this will work
Project.findOne({'_id':project_id}, function(err, project){
if(project){
this.now.talk(); // this will not work "TypeError: Cannot call method 'bark' of undefined"
};
});
};
des thats ahhhh brillant ce « que » est tout au sujet. –