简体   繁体   English

AngularJS 1.2和IE9页面标题的奇怪行为

[英]AngularJS 1.2 and IE9 strange behaviour with page title

In my Angular application I have one static page title: 在我的Angular应用程序中,我有一个静态页面标题:

<title>Title</title>

A problem appears when I'm changing the view with $location.path('/home') . 当我用$location.path('/home')更改视图时出现问题。 IE appends the string $/home to my page title, like this: IE将字符串$/home附加到我的页面标题,如下所示:

Title#/home#/home 标题#/家#/家

After a while, the title string becomes so long that IE displays an error and I have to refresh page. 过了一会儿,标题字符串变得太长,IE显示错误,我必须刷新页面。 When I change the view by clicking <a href='#/home'> links, the page title isn't changed. 当我通过单击<a href='#/home'>链接更改视图时,页面标题不会更改。

How can I prevent this when using $location.path() ? 使用$location.path()时如何防止这种情况?

I have tried it in Plunker and it work perfectly. 我在Plunker尝试了它,它完美地工作。 Here it is: 这里是:

http://plnkr.co/edit/pObS5qM0gd2Cr5iKnk8f http://plnkr.co/edit/pObS5qM0gd2Cr5iKnk8f

Notice that $location.path('/home') could be called without "/". 请注意,可以在没有“/”的情况下调用$location.path('/home')

$location.path('home')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM