opitzconsulting / jquery-mobile-angular-adapter

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

Undefined $.mobile.base with latest version #138

Closed rodcloutier closed 11 years ago

rodcloutier commented 11 years ago

Using the latest version I keep getting $.mobile.base as undefined at the last line of this snippet. Any lead on what is going on? Version 1.2.0 works fine with no code change.

 ng.run(['$rootScope', '$compile', function ($rootScope, $compile) {
    patchJq('page', function () {
        if (!preventJqmWidgetCreation() && !this.data("page")) {
            if (this.attr("data-" + $.mobile.ns + "external-page")) {
                correctRelativeLinks(this);
                $compile(this)($rootScope);
            }
        }
        return $.fn.orig.page.apply(this, arguments);
    });

    var base = $.mobile.base.element.attr("href");
tbosch commented 11 years ago

Sorry, I need more information to reproduce this. Could you create a jsfiddle?

I have tests for internal and external pages, and they all work...

Tobias

rodcloutier commented 11 years ago

I know I didn't have much to work on! Turns out that if you use a base tag (such as <base href="/">) you can reproduce the error.

I had such a tag left over in my page.

See fiddle http://jsfiddle.net/ZHKBA/113/

Should I change the issue's title ?

tbosch commented 11 years ago

Hi, your jsfiddle is working now. I took the chance to refactor the adjustment of relative links in external pages (for which I used the <base> tag).

Thanks, Tobias