href causes unintended page reload with Angularjs and Twitter Bootstrap

后端 未结 7 2003
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 16:02

I am working on a project that uses Angularjs and Twitter Bootstrap.

Bootstrap uses # to toggle components such as popover, modal etc. for example:

&         


        
7条回答
  •  伪装坚强ぢ
    2020-12-14 16:22

    I had similar issues, full page reload vs just view switching.

    Because Angular apps are SAPs, we only update whatever comes after hostname/#/.

    I instantiate a SuperController, kind of the application level controller and like Carlos V said, you can use ng-click instead of href to update $location.path().

    Here's a fiddle link

    Might not be the most optimal solution. Hope it helps.

提交回复
热议问题