ノードプロジェクトでnow.jsとMongooseを使用していますが、mongoose関数内でthis.nowオブジェクトにアクセスできません。例えば。JavaScript(node.js)変数は、内部関数呼び出しでアクセスできません。 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"
};
});
};
えーえ華麗なthatsのすべてに約ある「という」何をしたい値に
this
の値を設定します。 –