I am trying to make simple app in backbone .Actually I want to call methods when url change .I want to learn how backbone routing works .I studied routing but my alert is not display when I change the url . When I append the url with this “#contacts” but it is not calling this method
listContacts: function () {
alert("route")
console.log("route to list contacts was triggered");
ContactsApp.List.Controller.listContacts();
}
Can we move to next page or view while click to any item of list .Actually I want to move one page to another after click of row using backbone routing ?
here is my code http://plnkr.co/edit/yN16uPgk0dcJAcrApewH?p=preview
app.module("ContactsApp", function (ContactsApp, app, Backbone, Marionette, $, _) {
// console.log(app)
ContactsApp.Router = Marionette.AppRouter.extend({
appRoutes: {
"contacts": "listContacts"
}
});
var API = {
listContacts: function () {
alert("route")
console.log("route to list contacts was triggered");
ContactsApp.List.Controller.listContacts();
}
};
ContactsApp.on("start", function () {
new ContactsApp.Router({
controller: API
});
});
});
any update using marionette?