Adding a hash prefix at the config phase if it's missing

若如初见. 提交于 2019-12-05 09:58:45

I've had similar problem and manually (search/replace) went through all the links and fixed them.

The other problem I had was the external sites were using the old format i.e. http://plinkplink.net/#/event/3 instead of the new format http://plinkplink.net/#!/event/3

The fix I did for that is not strictly speaking angularjs idiomatic but it does the job. I've added this script to the header of my page. It simply redirects pages with # to pages with #!:

    <script>
        var loc = window.location.href
        if (loc.indexOf("#") != -1 &&  loc.indexOf("#!") == -1 ){
            window.location.href = loc.replace("#", "#!");
        }
    </script>

I hope it helps.

Are you linking to the # value? ie - <a href="#/my/page"> If so, you shouldn't be. You should be linking to the url without the # prefix and I believe it'll solve your issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!