ui-router icon indicating copy to clipboard operation
ui-router copied to clipboard

Unspecified error occurs in ie8 related to jquery.js when I switch state

Open beninfobelt opened this issue 13 years ago • 5 comments

Hi, I have come across an error in ie8 that I have pinpointed down to the use of a particular javascript library called nice-scroller:

github.com/inuyaksa/jquery.nicescroll.git

The error does not appear when I load a particular url path:

http://localhost:9000/#/home/projects

However, when I travel away from this url to another one, this error occurs only in ie8 (no issues in latest versions of Chrome and FF):

Unspecified error. jquery.js Code:0 URI: http://192.168.1.8:9000/bower_components/jquery/jquery.js

I am sure that I have pinpointed it down to nice-scroller because when I comment out this block in nice_scroller_directive.js, the error does not occur while using ie8:

/* $elem.niceScroll({ cursorborder:"#ddd",
cursorcolor:"#ddd",
cursoropacitymin:"0.0",
//cursoropacitymax:0.0,
cursorwidth:"10",
cursorborderradius:"0px",
//scrollspeed:100,
touchbehavior:"true",
bouncescroll:"true",
cursordragontouch:"true" }); */

To provide some further background, I use nicescroller in a directive called niceScrollbar and use that directive as an attribute in projects.html:

I am curious if anyone has come across any issues with jquery when traveling across different states created with ui-router?

Is there some sort of requirement to use .remove() or .detach() or .off() before the state switches?

I found this stackoverflow link that says "Unspecified errors seem to occur when something (usually a value) isn't set or initialized correctly that the browser is attempting to use."

http://stackoverflow.com/questions/7633722/what-does-unspecified-error-mean-in-ie

Perhaps, the issue arises because the niceScrollbar directive is not used within templateUrl's associated with the other states (that I click to from /#/home/projects).

I have created a plnkr here but it does not run because I have only included the relevant files. If there are additional files I can add to the plnkr to further clarify/detail my issues, please let me know:

http://plnkr.co/edit/gMaqNoiHN6DfBaJjHe82?p=preview

I am very grateful for any assistance you could provide.

All the best,

Ben

beninfobelt avatar Oct 04 '13 15:10 beninfobelt

I have created a plnkr here but it does not run because I have only included the relevant files.

If you've narrowed it down to the use of one component, couldn't you create a plunker that contains the relevant files for the actual problem without the extra stuff? The plunker you created has many things, but it doesn't demonstrate the problem you're having -- it doesn't have the partials for the default (otherwise) route, so it's doomed from the start.

laurelnaiad avatar Oct 04 '13 15:10 laurelnaiad

I have taken a swing at a sheared down version of a functioning plnkr here: http://plnkr.co/edit/f8dxg5WxGzf7VOwTNlnO?p=preview

Plnkr in general doesn't work for IE8 so after bringing down the files, I found out that I somehow sheared so much that I was able to keep the problematic javascript snippit (mentioned above) inside of nice_scroller_directive.js yet the Unspecified error does not show up as it does with my master original project.

When making the plunkr, I tried to replicate the setup from my master original project; where I have the nice-scroller js invocation is living in a directive called nice_scroller_directive.js that has restrict: 'A' . That nice_scroller_directive.js directive is used inside the template of another directive (called project_dir.js). The project_dir.js directive is used inside of the template (data.html) of a view (test) that is invoked from .state('data', in the app.js file.

~Unfortunately~ I was not able to replicate the IE8 Unspecified error when I pulled down the files from this plnkr. I think maybe the problem is related to nicescroll( { ... } ) being invoked after the directive that it lives on is no longer present in the DOM? In my master original project, the Unspecified error only appears when I leave the url that features the nice-scroller js - - - - - which is why i am here in this forum bc I'm not sure if the problem is related to the use of state and the use of views

The files for my master original project can be found at this address if you are curious and have a moment to help: http://seasidesyndication.com/angular/app.zip

beninfobelt avatar Oct 08 '13 21:10 beninfobelt

Also @stu-salsbury

Can you please tell me more about what you meant here:

"it doesn't have the partials for the default (otherwise) route, so it's doomed from the start."

In my app file, I have $urlRouterProvider.otherwise('/home/data');

Is it bad form to point the names of states instead of .html partial templates?

beninfobelt avatar Oct 08 '13 21:10 beninfobelt

Your partials weren't in the plunker I looked at so there was no chance to see what was up.

laurelnaiad avatar Oct 08 '13 22:10 laurelnaiad

Closing for inactivity.

timkindberg avatar Jul 16 '14 02:07 timkindberg