自从将Meteor升级到1.0版以来,是否有其他人从Iron-Router收到以下错误?
如果您知道如何解决此问题,请在此处发布.
路线调度从未呈现.你忘记打电话
this.next()了onBeforeAction?
Router.map(function () {
Router.route('profileShow', {
waitOn: function () {
if (Meteor.user()) {
Meteor.subscribe('userData');
} else {
this.next();
}
},
data: function () {
if (Meteor.user()) {
return {profile: Meteor.user().profile};
}
}
});
});
Run Code Online (Sandbox Code Playgroud) 如果您有onRendered回调,则可以记录this以获取模板.
Template.myTemplate.onRendered(function () {
console.log(this);
});
Run Code Online (Sandbox Code Playgroud)
出于调试目的,在javascript控制台中,是否可以通过某种脚本获取当前呈现的模板?例如:
> var ctx = Template.myTemplate // something like this
Run Code Online (Sandbox Code Playgroud) 我可以访问服务器,但无法发布表单数据。我应该如何通过https请求发布表单数据?我正在使用表单数据库中的表单数据,并使用https请求进行邮寄。当我运行以下代码时,我可以访问该服务,但是该服务给出的响应是未提交表单数据。
var https = require('https');
var FormData = require('form-data');
//var querystring = require('querystring');
var fs = require('fs');
var form = new FormData();
connect();
function connect() {
username = "wr";
password = "45!"
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
var options = {
hostname: 'trans/sun.com',
port: 443,
path: '/transfer/upload-v1/file',
method: 'POST',
rejectUnauthorized: false,
headers: {
'Authorization': auth,
'Content-Type': 'application/json',
//'Content-Length': postData.length
}
};
form.append('deviceId', '2612');
form.append('compressionType', 'Z');
form.append('file', fs.createReadStream('/Mybugs.txt'));
var req = https.request(options, function(res) { …Run Code Online (Sandbox Code Playgroud)