If you want better results, you can use the H5 的新特性 history.pushState(state, title, url) ,这个方法不但能修改 title ,还能同时修改 url address and record this information into the history stack. When the user uses the browser's back button, they will get a better experience.
I saw an answer on stackoverflow, he implemented it like this
First add a global controller to the html:
Then I wrote a factory:
Then
index.html
主页面中就可以通过<h1>{{ Page.title() }}</h1>
get the page titleIt is very simple to set the title of the specific corresponding page, just inject this
Page
into your controllerHere is the specific implementation: http://plnkr.co/edit/0e7T6l?p=info
js
中使用document.title = '...'
就能修改title
Got itIf you want better results, you can use the
H5
的新特性history.pushState(state, title, url)
,这个方法不但能修改title
,还能同时修改url
address and record this information into the history stack. When the user uses the browser's back button, they will get a better experience.