Thanks for making jQM work with Backbone and your excellent addition to the community. After way too much trial and tribulation, I'm about there in getting this all to work together. Our app is very complex so there's a ton going on and I can't post much of it.
Basically, here's what's going on: I'm using single-page templates loaded with separate ids from our master routes. We have an mView.ejs file that looks like this;
<div id="<%= id %>" data-role="page">
<%- partial('mHeader') %>
<div data-role="content">
</div>
</div>
<div id="solo" data-role="page">
<%- partial('mHeader') %>
<div data-role="content">
</div>
</div>
That file is called with separate ids from our main backend routes file and works great for loading from one page and then navigating around. At this point, I have 3 routes setup. Two of them are absolute urls and one is hash-based. The solo above is the hash-based route.
Here's the deal I can visit the first page and the hash based url without an issue. It's important to note the URL I'm having problems with directory style i.e.: http://domain.com/directory/longassid
This works when navigating but when visiting that page directly the router is never fired. It gets there, but it doesn't recognize the regex. There's no match. Here's what the regex looks like:
new $.mobile.Router([,
{ "main" : { handler: 'main', events: 'bs' } },
{ "single\/([^?#]*)?" : { handler: 'single', events: 'bs' } },
{ "#solo[?](.*)?" : { handler: 'solo', events: 'bs' } }
], {
// HANDLER FUNCTIONS
},
{ ajaxApp: true }
The single one is the route not matched on refresh. Pageinit is fired which fires our chrome and it fires the router. No issues there and it makes it all the way to the router but it isn't matched. Now, if I remove the extra stuff from after the single regex then it matches on refresh but of course no id is passed. What can I do to fix this? Is it just a regex issue? Any ideas?
Once again, I want to stress this route works fine when navigating through the app.
Thanks so much for any help!