opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

Removing leading slash causes problems - realitve urls should be relative and absolute should be absoulte #155

Closed caseman72 closed 11 years ago

caseman72 commented 11 years ago

https://github.com/tigbro/jquery-mobile-angular-adapter/commit/41eafee3e1e35667aa1d03074147c486232c058b

I had to comment out this code:

            if (url && url.charAt(0)==='/') {
                url = url.slice(1);
            }
tbosch commented 11 years ago

Hi, could you describe your usecase where this leads to a problem? As this was the solution to another issue...

Tobias

caseman72 commented 11 years ago

I will try to get a plunkr or other if possible...

Our application has templates that are sub-application like:

  1. templateUrl: /mobile/template.page1/
  2. route is setup as: $routeProvider.when("/page1/", {jqmOptions: options, templateUrl: "/mobile/template.page1/"})
  3. application's base url is at: /mobile/admin/
  4. page1 is at: /mobile/admin/page1/
  5. when you click on page 1 Page1 - it loads: /mobile/admin/mobile/template.page1/
caseman72 commented 11 years ago

Here's an example - needs to be served; not loaded locally - I added a app.js (node) file if you have nodejs installed - npm install express (root folder) and then node app.js to sever locally on port 3030...

https://github.com/caseman72/rockalldaylong.com/blob/master/temp/plunkr.zip?raw=true

tbosch commented 11 years ago

Hi, now I understand your problem: Your templates are not in a sub folder of your main page. A workaround would be to put your templates somewhere below /mobile/admin, e.g. /mobile/admin/templates...

But your are right: We could relax this restriction. What do you think?

Tobias

caseman72 commented 11 years ago

The system basically says anything that starts with /mobile/admin/ is the "app" and server the index.html page for that "app" so /mobile/admin/template/ would have to be an exception to our system's architecture ...

You could add a check for starts with base and then leave it alone - if not - remove the slash ...