Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

LocationHashbangUrl() undefined error 1.2 rc3 #4776

Closed
@adrianprofero

Description

@adrianprofero

My site has two types of pages using Angular 1.2rc3. The first uses $locationProvider.html5Mode(true) for changing the url without reloading and the other type act like a normal html page with full page refreshes on clicking a link

Each section works fine but if i try click the back button from a non html5mode page into a page with html5Mode(true) then the error below is thrown because "withoutBaseUrl" is undefined. The beginsWith function can return undefined so .charAt(0) on the return value of that function is bad

Back button works fine on pages within either section so seems like a routing variable is being carried over into the non html5 page and either Angular is checking for a hash when there is no need to or the appBase reference is wrong

TypeError: Cannot call method 'charAt' of undefined
at Object.LocationHashbangUrl.$$parse (angular.js:7694:49)
at angular.js:8112:39
at Scope.$eval (angular.js:10700:44)
at Scope.$digest (angular.js:10548:53)
at angular.js:8115:61
at angular.js:3883:17
at Array.forEach (native)
at forEach (angular.js:213:21)
at fireUrlChange (angular.js:3882:13)
at x.event.dispatch (jquery-1.10.1.min.js:5:14113)

function LocationHashbangUrl(appBase, hashPrefix) {
var appBaseNoFile = stripFile(appBase);
parseAbsoluteUrl(appBase, this);

    /**
     * Parse given hashbang url into properties
     * @param {string} url Hashbang url
     * @private
     */
    this.$$parse = function(url) { 
        var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
        var withoutHashUrl = withoutBaseUrl.charAt(0) == '#'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions