gfranko / jquery.tocify.js

A jQuery Table of Contents plugin that can be themed with Twitter Bootstrap or jQueryUI.
http://gregfranko.com/jquery.tocify.js/
MIT License
928 stars 216 forks source link

AngularJS Compatibility? #89

Open solarisfire opened 8 years ago

solarisfire commented 8 years ago

Would love to have this working with AngularJS.

I have jquery, jquery-ui, and tocify included, and if I call .tocify() on a div after the AngularJS digest cycle using $timeout it gives me a table of contents.

However clicking on any element in the toc just directs me to a different route, not to the right position on the page.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

agez commented 8 years ago

I think that you have to change "history" to false. It is true by default and creates hashes in the URL.

We also use tocify within an AngularJs app for about 3 years. And as far as I remember we had the same issues with routing. Switching "history" to false did the trick.

HTH.

solarisfire commented 8 years ago

Yup that worked, however it won't stick to the top of the page on scroll. Guess I could always supplement it with something like ngSticky for that...

solarisfire commented 8 years ago

Getting MAJOR performance issues though, running tocify on the content after each route change. But looks like tocify isn't cleaning up after changing route so is leaking memory...