In my Meteor app Backbone routers are only working when the user is logged in (via the accounts-base package). It's strange. This router itself works fine. The showSaying()
function isn't being called at all when the user is not logged in.
Below is the code in client.js
within the client folder. Do I need to do something with sessions or auto-publishing?
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});
});