简体   繁体   English

铁路由器和流星1.0.2.1

[英]Iron Router and Meteor 1.0.2.1

When I run on my computer, everything inorder, and when the load on meteor.chom then receive message "iron:router Organize your Meteor application." 当我在计算机上运行时,一切井井有条,当meteor.chom上的负载出现时,您会收到消息“ iron:router整理您的Meteor应用程序”。

That's my file with configs 那是我的配置文件

Router.route( '/', function(){
if (this.ready()) {
    this.render('content', {});
 } else {
    this.render('Loading');
}}

)

'Content' - template with my data. “内容”-包含我的数据的模板。 There are link on one of template : <a href="{{pathFor 'csv'}}">Convert to CSV and download</a> . 模板之一上有链接: <a href="{{pathFor 'csv'}}">Convert to CSV and download</a> That's configurations for it 这是它的配置

Router.route('/csv', {
  where: 'server',
  action: function () {
    var filename = 'venues' + '.csv';
    var csv = new CSV1();

    var fileData =  csv.fromJsonToCsv(Venues.find().fetch());

    var headers = {
      'Content-type': 'text/csv',
      'Content-Disposition': "attachment; filename=" + filename
    };
    this.response.writeHead(200, headers);
    return this.response.end(fileData);
  }
});

Why server (meteor.com) send message (error) ? 为什么服务器(meteor.com)发送消息(错误)? And second questions: Link "Convert to CSV and download" is work only after first click. 第二个问题:链接“转换为CSV和下载”仅在第一次单击后有效。 How this fix? 如何解决? Needed that it working after on all clicks. 需要它在所有点击后都能正常工作。

Seeing "iron:router Organize your Meteor application." 看到“ iron:router整理您的Meteor应用程序”。 means either that you don't have routing code on your site or that there's an error in the router code. 表示您的站点上没有路由代码,或者路由器代码中有错误。 Have you looked at the server console output to see what's going on? 您是否查看了服务器控制台的输出以查看发生了什么? Your first router code sample works perfectly in a minimal test app I've created here. 您的第一个路由器代码示例可在我在此处创建的最小测试应用程序中完美运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM