私のMeteorアプリでは、バックボーンルーターは、ユーザーが(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});
});