在我的 Meteor 应用程序中,Backbone 路由器仅在用户登录时工作(通过 accounts-base 包)。真奇怪。该路由器本身工作正常。showSaying()
当用户未登录时,根本不会调用该函数。
以下是client.js
客户端文件夹中的代码。我需要对会话或自动发布做些什么吗?
AphorismView = Backbone.View.extend({
el: "#aphorism-item",
initialize: function(){
_.bindAll(this, "render");
this.render();
},
render: function() {
this.$el.append("<p style='height:600px; background-color:blue;'>hi</p>");
}
});
// Creates a route to view the selected aphorism
var Aphorism = Backbone.Router.extend({
routes: {
"saying/:id": "showSaying"
},
showSaying: function (id) {
var aphorism_view = new AphorismView();
alert('Saying id ' + id + '.');
}
});
//establishes the router
appRouter = new Aphorism;
//Sets up backbone
Meteor.startup(function () {
filepicker.setKey("AerIOvsmAQRGaNdEv0judz");
filepicker.constructWidget(document.getElementById('attachment'));
Backbone.history.start({pushState: true});
});