如何在流星中不使用JavaScript渲染模板?

时间:2015-04-13 07:42:00

标签: javascript meteor meteor-helper

我在流星中使用iron:router。在我的情况下,我想在iframe中包含模板。

template.html

<iframe src="{{pathFor 'MyTemplate'}}" width="100%"></iframe>

route.js

this.route('MyTemplate', {path: '/MyTemplate',layoutTemplate:'MyTemplate'});

当我在iframe中渲染这个神殿时。它用javascript和CSS渲染。我这里只需要css。无论如何都要限制特定路径中的JavaScript。

1 个答案:

答案 0 :(得分:0)

我不确定它是否符合您的要求,但您可以通过执行此类操作来添加javascript来呈现HTML而不添加meavascript:

Router.route('/MyTemplate', function () {
 this.response.end('<html><h1> hello world </h1></html>');
  }, {where: 'server'});
});

在服务器部分使用该代码。

相关问题