You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I've been using AngularJS (v1.2.14) with a Ruby on Rails app, which has turbolinks turned on. It's been working great and I haven't had any issues (up until now).
I notice now though there is an issue when including the $location service. Simply importing this service into directive/controller/service will cause a JS error when clicking the browser's back button:
TypeError: Cannot call method 'charAt' of undefined
at Object.LocationHashbangUrl.$$parse (http://test.delman.dev/assets/angular.js?body=1:8839:41)
at http://test.delman.dev/assets/angular.js?body=1:9318:21
at Scope.$eval (http://test.delman.dev/assets/angular.js?body=1:12076:28)
at Scope.$digest (http://test.delman.dev/assets/angular.js?body=1:11904:31)
at http://test.delman.dev/assets/angular.js?body=1:9327:45
at http://test.delman.dev/assets/angular.js?body=1:4336:7
at Array.forEach (native)
at forEach (http://test.delman.dev/assets/angular.js?body=1:323:11)
at fireUrlChange (http://test.delman.dev/assets/angular.js?body=1:4335:5)
at jQuery.event.dispatch (http://test.delman.dev/assets/jquery.js?body=1:3075:9)
I guess I could just avoid the $location service... the problem is some 3rd party libraries (i.e. angular-strap) are including it.
Not ruling out this being a turbolinks issue either - I'm not really sure what's causing the error in the AngularJS internals
The text was updated successfully, but these errors were encountered:
According to the docs, turbolinks does its own weird version of PJAX routing, without requiring you to fiddle with response (by removing layout, for example).
Now, $location is doing 2 things: 1) on click events, it will check the URL you clicked on, and if it's the app url, and if it's an app url, it gets parsed. 2) on browser url change, it will try to parse the url.
I think you're running into situation #2, because otherwise I'd expect the link to just not be followed. So here's what's happening:
I've been using AngularJS (v1.2.14) with a Ruby on Rails app, which has turbolinks turned on. It's been working great and I haven't had any issues (up until now).
I notice now though there is an issue when including the
$location
service. Simply importing this service into directive/controller/service will cause a JS error when clicking the browser's back button:I guess I could just avoid the
$location
service... the problem is some 3rd party libraries (i.e. angular-strap) are including it.Not ruling out this being a turbolinks issue either - I'm not really sure what's causing the error in the AngularJS internals
The text was updated successfully, but these errors were encountered: