只需點擊一個按鈕,我想讓頁面滾動某個格bottom
。
的第一時間我點擊,頁面將會非常頂部和初始URL http://localhost:8000
成爲http://localhost:8000/#/bottom
(爲什麼它不會去div
我提到)。
的第二次我按一下按鈕,則網址 http://localhost:8000/#/bottom#bottom
和它去到div bottom
(這正是我想要)。
我該如何處理?
代碼片段
$location.hash('bottom');
$anchorScroll();
在此先感謝
做,如果需要尋求更多的解釋。 。 。
也許你使用[ui-router](https://github.com/angular-ui/ui-router)和頁面重新渲染散列變化? –
不,我不使用ui路由器 – dreamer