Използвам iron:[email protected] с meteor 9.3.1.
Код на шаблона:
<head>
<title>ironman</title>
</head>
<body>
</body>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
Javascript код:
if (Meteor.isClient) {
// counter starts at 0
Session.setDefault("counter", 0);
Template.hello.helpers({
counter: function() {
return Session.get("counter");
}
});
Template.hello.events({
'click button': function() {
// increment the counter when button is clicked
Session.set("counter", Session.get("counter") + 1);
}
});
Router.route('/', function() {
this.render('hello');
});
}
Определеният по-горе маршрут не работи. Въпреки това, ако поставя дефиницията на маршрут извън if (Meteor.isClient) {
, тя започва да работи.
Това по дизайн ли е? Моля за съвет.